Parses the input source into a yaidom Document
.
Parses the input source into a yaidom Document
. Closes the input stream or reader afterwards.
Parses the content of the given File into a eu.cdevreeze.yaidom.simple.Document.
Parses the content of the given File into a eu.cdevreeze.yaidom.simple.Document.
Parses the content of the given URI into a eu.cdevreeze.yaidom.simple.Document.
Parses the content of the given URI into a eu.cdevreeze.yaidom.simple.Document.
Parses the content of the given input stream into a eu.cdevreeze.yaidom.simple.Document.
Parses the content of the given input stream into a eu.cdevreeze.yaidom.simple.Document.
Returns an adapted copy having the passed ConverterToDocument.
Returns an adapted copy having the passed ConverterToDocument. This method makes it possible to use an adapted converter, which may be needed depending on the JAXP implementation used.
DOM-LS-based
Document
parser.Typical non-trivial creation is as follows, assuming class
MyEntityResolver
, which extendsLSResourceResolver
, and classMyErrorHandler
, which extendsDOMErrorHandler
:A custom
LSResourceResolver
could be used to retrieve DTDs locally, or even to suppress DTD resolution. The latter can be coded as follows (see http://stuartsierra.com/2008/05/08/stop-your-java-sax-parser-from-downloading-dtds), risking some loss of information:For completeness, a custom
DOMErrorHandler
class that simply throws an exception:If more flexibility is needed in configuring the
DocumentParser
than offered by this class, consider writing a wrapperDocumentParser
which wraps aDocumentParserUsingDomLS
, but adapts theparse
method.A
DocumentParserUsingDomLS
instance can be re-used multiple times, from the same thread. If theDOMImplementationLS
is thread-safe, it can even be re-used from multiple threads. Typically aDOMImplementationLS
cannot be trusted to be thread-safe, however. In a web application, one (safe) way to deal with that is to use oneDOMImplementationLS
instance per request.