Instantiate this parser to parse a fast infoset document in accordance with the DOM API.
47484950515253545556575859
return Node.class; } public Node transform(InputStream source, TransformationContext context) { try { DOMDocumentParser parser = new DOMDocumentParser(); Document doc = DOMHelper.newDocument(); parser.parse(doc, source); return doc.getDocumentElement(); } catch (Exception e) { throw new TransformationException(e); } }
52535455565758596061626364
{ // Parse the XML input stream Element domEnv = null; try { DOMDocumentParser parser = new DOMDocumentParser(); Document resDoc = DOMUtils.getDocumentBuilder().newDocument(); parser.parse(resDoc, ins); domEnv = resDoc.getDocumentElement(); } catch (Exception ex) { if (ignoreParseError)
106107108109110111112113114115
return bais; } private Document getFastDocument(ByteArrayInputStream bais) throws FastInfosetException, IOException { DOMDocumentParser parser = new DOMDocumentParser(); Document resDoc = DOMUtils.getDocumentBuilder().newDocument(); parser.parse(resDoc, bais); return resDoc; }
116117118119120121122123124125126
is.close(); } private void readWithFIDom() throws FastInfosetException, IOException { InputStream is = new FileInputStream(fiFile); DOMDocumentParser ddp = new DOMDocumentParser(); Document document; document = documentBuilder.newDocument(); ddp.parse(document, is); is.close(); }
54555657585960616263646566
464748495051525354555657
DocumentBuilder db = dbf.newDocumentBuilder(); Document d; if (isFastInfosetDocument) { d = db.newDocument(); DOMDocumentParser ddp = new DOMDocumentParser(); ddp.parse(d, document); } else { if (workingDirectory != null) { db.setEntityResolver(createRelativePathResolver(workingDirectory)); } d = db.parse(document);