dtd = new DTDMonitor();
dtd.handleDTD(reader);
// Create a new internal DOM and set up its builder
dom = new DOMImpl();
final DOMBuilder builder = dom.getBuilder();
try {
reader.setProperty(LEXICAL_HANDLER_PROPERTY, builder);
}
catch (SAXException e) {
// quitely ignored
}
reader.setContentHandler(builder);
// Parse the input and build the internal DOM
reader.parse(input);
dom.setDocumentURI(_sourceSystemId);
}
else if (source instanceof DOMSource) {
final DOMSource domsrc = (DOMSource) source;
final org.w3c.dom.Node node = domsrc.getNode();
final DOM2SAX dom2sax = new DOM2SAX(node);
// Create a DTD monitor to trap all DTD/declarative events
dtd = new DTDMonitor();
dtd.handleDTD(dom2sax);
// Create a new internal DOM and set up its builder to trap
// all content/lexical events
dom = new DOMImpl();
final DOMBuilder builder = dom.getBuilder();
dom2sax.setContentHandler(builder);
// Parse the input and build the internal DOM
dom2sax.parse();
dom.setDocumentURI(_sourceSystemId);
}
else if (source instanceof StreamSource) {
// Get all info from the input StreamSource object
final StreamSource stream = (StreamSource)source;
final InputStream streamInput = stream.getInputStream();
final Reader streamReader = stream.getReader();
final XMLReader reader = _tfactory.getXMLReader();
// Create a DTD monitor to trap all DTD/declarative events
dtd = new DTDMonitor();
dtd.handleDTD(reader);
// Create a new internal DOM and set up its builder to trap
// all content/lexical events
dom = new DOMImpl();
final DOMBuilder builder = dom.getBuilder();
try {
reader.setProperty(LEXICAL_HANDLER_PROPERTY, builder);
}
catch (SAXException e) {
// quitely ignored