List of utility methods to do XML Parse Stream
void | getNextStartElement(XMLStreamReader parser) get Next Start Element while (parser.hasNext()) { int event = parser.next(); if (event == XMLStreamConstants.START_ELEMENT) { return; |
byte[] | getParamStream(XMLOutputFactory outputFactory, XMLEventFactory eventFactory, XMLEventReader parser, XMLEvent paramEvent) get Param Stream ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); XMLEventWriter writer = outputFactory.createXMLEventWriter(outputStream); writer.add(eventFactory.createStartElement("", null, "g")); Integer level = 1; while (!(parser.hasNext() && paramEvent.isEndElement() && level == 0)) { paramEvent = parser.nextEvent(); writer.add(paramEvent); if (paramEvent.isStartElement()) { ... |
void | parse(DefaultHandler handler, InputStream in) Parse the XML data in the given input stream, using the specified handler object as both the content and error handler. XMLReader xr = _pfactory.newSAXParser().getXMLReader();
xr.setContentHandler(handler);
xr.setErrorHandler(handler);
xr.parse(new InputSource(in));
|
Document | parse(final InputStream in) Parse an XML document. return parse(new InputSource(in)); |
Document | parse(final InputStream inputStream) Parses a new XML Document from a given InputStream return parse(new InputSource(inputStream)); |
Document | parse(final InputStream is) Grab the Document loaded from the specified InputStream return getThreadedDocumentBuilder().parse(is);
|
Document | parse(InputStream anInputStream) parse Document document; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { DocumentBuilder builder = factory.newDocumentBuilder(); document = builder.parse(anInputStream); } catch (Exception e) { throw new RuntimeException(e); return document; |
Document | parse(InputStream byteStream) Parses the input stream and returns a DOM Document . DOMImplementationLS impl = (DOMImplementationLS) getDOMImplementation(); LSInput input = impl.createLSInput(); input.setByteStream(byteStream); LSParser builder = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null); DOMConfiguration config = builder.getDomConfig(); config.setParameter("comments", false); config.setParameter("element-content-whitespace", false); return builder.parse(input); ... |
Document | parse(InputStream in) parse try { DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); return db.parse(in); } catch (Exception x) { throw new RuntimeException("Error parsing XML string.", x); |
Document | parse(InputStream in) parse DocumentBuilder d = getDocumentBuilder(); try { Document doc = d.parse(in); doc.normalize(); return doc; } catch (SAXException e) { throw new RuntimeException("Bad xml-code: " + e.toString()); } catch (IOException f) { ... |