/** * Parse an XML stream using the pooled document builder. * @param inputStream input stream * @return parsed XML document */ public static Document parse(InputStream inputStream) throws SAXException, IOException { return parse(new InputSource(inputStream)); }
/** * Parse a String into a DOM. * * @param s DOCUMENTME * * @return DOCUMENTME * * @throws SAXException DOCUMENTME * @throws IOException DOCUMENTME */ static public Element stringToDOM(String s) throws SAXException, IOException { return parse(new InputSource(new StringReader(s))).getDocumentElement(); }
public static Document parse(XMLStreamReader reader) throws XMLStreamException { Document doc = newDocument(); parse(reader, doc, doc); return doc; }
public static void assign(MessageDAO m, XmlObject o) throws Exception { NodeList nodes = DOMUtils.parse(o.newInputStream(new XmlOptions().setSaveOuter())).getDocumentElement().getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); if (n instanceof Element) { m.setData((Element) n); } } }
private String loadXsltSheet(URI uri) { // TODO: lots of null returns, should have some better error messages. InputStream is; try { is = _resourceFinder.openResource(uri); } catch (Exception e1) { return null; } if (is == null) return null; try { // verify that sheet is well-formed and preserve encoding. Document doc = DOMUtils.parse(is); return DOMUtils.domToString(doc); } catch (Exception e) { __log.debug("IO error", e); // todo: this should produce a message return null; } finally { try { is.close(); } catch (Exception ex) { // No worries. } } }
parse(reader, doc, e);
InputSource sax = ((SAXSource) inputSource).getInputSource(); if (sax.getCharacterStream() != null || sax.getByteStream() != null) { return parse( ((SAXSource) inputSource).getInputSource() );
Document doc = DOMUtils.parse(new InputSource(new ByteArrayInputStream(schema))); String schemaTargetNS = doc.getDocumentElement().getAttribute("targetNamespace"); if (schemaTargetNS != null && schemaTargetNS.length() > 0) {
Node requestNode = DOMUtils.parse(request.newXMLStreamReader()); if (__log.isDebugEnabled()) { __log.debug("request " + request.toString());