public class DefaultDocumentLoader extends 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 DocumentBuilder |
createDocumentBuilder(DocumentBuilderFactory factory,
EntityResolver entityResolver,
ErrorHandler errorHandler)
Create a JAXP DocumentBuilder that this bean definition reader
will use for parsing XML documents.
|
protected DocumentBuilderFactory |
createDocumentBuilderFactory(int validationMode,
boolean namespaceAware)
Create the
DocumentBuilderFactory instance. |
Document |
loadDocument(InputSource inputSource,
EntityResolver entityResolver,
ErrorHandler errorHandler,
int validationMode,
boolean namespaceAware)
Load the
Document at the supplied InputSource using the standard JAXP-configured
XML parser. |
public Document loadDocument(InputSource inputSource, EntityResolver entityResolver, ErrorHandler errorHandler, int validationMode, boolean namespaceAware) throws Exception
Document at the supplied InputSource using the standard JAXP-configured
XML parser.loadDocument in interface DocumentLoaderinputSource - 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 provideddocumentException - if an error occursprotected DocumentBuilderFactory createDocumentBuilderFactory(int validationMode, boolean namespaceAware) throws ParserConfigurationException
DocumentBuilderFactory instance.validationMode - the type of validation: DTD
or XSD)namespaceAware - whether the returned factory is to provide support for XML namespacesParserConfigurationException - if we failed to build a proper DocumentBuilderFactoryprotected DocumentBuilder createDocumentBuilder(DocumentBuilderFactory factory, @Nullable EntityResolver entityResolver, @Nullable ErrorHandler errorHandler) throws ParserConfigurationException
factory - the JAXP DocumentBuilderFactory that the DocumentBuilder
should be created withentityResolver - the SAX EntityResolver to useerrorHandler - the SAX ErrorHandler to useParserConfigurationException - if thrown by JAXP methods