public class DocumentProvider extends java.lang.Object implements Provider
DocumentProvider object is used to provide event
reader implementations for DOM. Wrapping the mechanics of the
DOM framework within a Provider ensures that it can
be plugged in without any dependencies. This allows other parsers
to be swapped in should there be such a requirement.DocumentProvider| Constructor and Description |
|---|
DocumentProvider()
Constructor for the
DocumentProvider object. |
DocumentProvider(javax.xml.parsers.DocumentBuilderFactory factory)
Constructor for the
DocumentProvider object using
an externally configured factory. |
| Modifier and Type | Method and Description |
|---|---|
EventReader |
provide(java.io.InputStream source)
This provides an
EventReader that will read from
the specified input stream. |
EventReader |
provide(java.io.Reader source)
This provides an
EventReader that will read from
the specified reader. |
static javax.xml.parsers.DocumentBuilderFactory |
safeDocumentBuilderFactory() |
public DocumentProvider()
DocumentProvider object. This
uses the default DocumentBuilderFactory.newInstance() and
preconfigures the factory with "safe" defaults.public DocumentProvider(javax.xml.parsers.DocumentBuilderFactory factory)
DocumentProvider object using
an externally configured factory.public EventReader provide(java.io.InputStream source) throws java.lang.Exception
EventReader that will read from
the specified input stream. When reading from an input stream
the character encoding should be taken from the XML prolog or
it should default to the UTF-8 character encoding.public EventReader provide(java.io.Reader source) throws java.lang.Exception
EventReader that will read from
the specified reader. When reading from a reader the character
encoding should be the same as the source XML document.public static javax.xml.parsers.DocumentBuilderFactory safeDocumentBuilderFactory()
DocumentBuilderFactory preconfigured to disable
entity expansion and external DTD resolution.