public class DefaultDocumentLoader extends java.lang.Object implements DocumentLoader
DocumentLoader
implementation.
Simply loads documents
using the standard JAXP-configured
XML parser. If you want to change the DocumentBuilder
that is used to
load documents, then one strategy is to define a corresponding Java system property
when starting your JVM. For example, to use the Oracle DocumentBuilder
,
you might start your application like as follows:
java -Djavax.xml.parsers.DocumentBuilderFactory=oracle.xml.jaxp.JXDocumentBuilderFactory MyMainClass
Constructor and Description |
---|
DefaultDocumentLoader() |
Modifier and Type | Method and Description |
---|---|
protected javax.xml.parsers.DocumentBuilder |
createDocumentBuilder(javax.xml.parsers.DocumentBuilderFactory factory,
org.xml.sax.EntityResolver entityResolver,
org.xml.sax.ErrorHandler errorHandler)
Create a JAXP DocumentBuilder that this bean definition reader
will use for parsing XML documents.
|
protected javax.xml.parsers.DocumentBuilderFactory |
createDocumentBuilderFactory(int validationMode,
boolean namespaceAware)
Create the
DocumentBuilderFactory instance. |
org.w3c.dom.Document |
loadDocument(org.xml.sax.InputSource inputSource,
org.xml.sax.EntityResolver entityResolver,
org.xml.sax.ErrorHandler errorHandler,
int validationMode,
boolean namespaceAware)
Load the
Document at the supplied InputSource using the standard JAXP-configured
XML parser. |
public org.w3c.dom.Document loadDocument(org.xml.sax.InputSource inputSource, org.xml.sax.EntityResolver entityResolver, org.xml.sax.ErrorHandler errorHandler, int validationMode, boolean namespaceAware) throws java.lang.Exception
Document
at the supplied InputSource
using the standard JAXP-configured
XML parser.loadDocument
in interface DocumentLoader
inputSource
- the source of the document that is to be loadedentityResolver
- the resolver that is to be used to resolve any entitieserrorHandler
- used to report any errors during document loadingvalidationMode
- the type of validation
DTD
or XSD
)namespaceAware
- true
if support for XML namespaces is to be provideddocument
java.lang.Exception
- if an error occursprotected javax.xml.parsers.DocumentBuilderFactory createDocumentBuilderFactory(int validationMode, boolean namespaceAware) throws javax.xml.parsers.ParserConfigurationException
DocumentBuilderFactory
instance.validationMode
- the type of validation: DTD
or XSD
)namespaceAware
- whether the returned factory is to provide support for XML namespacesjavax.xml.parsers.ParserConfigurationException
- if we failed to build a proper DocumentBuilderFactoryprotected javax.xml.parsers.DocumentBuilder createDocumentBuilder(javax.xml.parsers.DocumentBuilderFactory factory, org.xml.sax.EntityResolver entityResolver, org.xml.sax.ErrorHandler errorHandler) throws javax.xml.parsers.ParserConfigurationException
factory
- the JAXP DocumentBuilderFactory that the DocumentBuilder
should be created withentityResolver
- the SAX EntityResolver to useerrorHandler
- the SAX ErrorHandler to usejavax.xml.parsers.ParserConfigurationException
- if thrown by JAXP methods