public class

DefaultDocumentLoader

extends Object
implements DocumentLoader
java.lang.Object
   ↳ org.springframework.beans.factory.xml.DefaultDocumentLoader

Class Overview

Spring's default 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

Summary

Public Constructors
DefaultDocumentLoader()
Public Methods
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.
Protected Methods
DocumentBuilder createDocumentBuilder(DocumentBuilderFactory factory, EntityResolver entityResolver, ErrorHandler errorHandler)
Create a JAXP DocumentBuilder that this bean definition reader will use for parsing XML documents.
DocumentBuilderFactory createDocumentBuilderFactory(int validationMode, boolean namespaceAware)
Create the DocumentBuilderFactory instance.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.beans.factory.xml.DocumentLoader

Public Constructors

public DefaultDocumentLoader ()

Also: SpringBeans

Public Methods

public Document loadDocument (InputSource inputSource, EntityResolver entityResolver, ErrorHandler errorHandler, int validationMode, boolean namespaceAware)

Also: SpringBeans

Load the Document at the supplied InputSource using the standard JAXP-configured XML parser.

Parameters
inputSource the source of the document that is to be loaded
entityResolver the resolver that is to be used to resolve any entities
errorHandler used to report any errors during document loading
validationMode the type of validation DTD or XSD)
namespaceAware true if support for XML namespaces is to be provided
Returns
Throws
Exception

Protected Methods

protected DocumentBuilder createDocumentBuilder (DocumentBuilderFactory factory, EntityResolver entityResolver, ErrorHandler errorHandler)

Also: SpringBeans

Create a JAXP DocumentBuilder that this bean definition reader will use for parsing XML documents. Can be overridden in subclasses, adding further initialization of the builder.

Parameters
factory the JAXP DocumentBuilderFactory that the DocumentBuilder should be created with
entityResolver the SAX EntityResolver to use
errorHandler the SAX ErrorHandler to use
Returns
  • the JAXP DocumentBuilder
Throws
ParserConfigurationException if thrown by JAXP methods

protected DocumentBuilderFactory createDocumentBuilderFactory (int validationMode, boolean namespaceAware)

Also: SpringBeans

Create the DocumentBuilderFactory instance.

Parameters
validationMode the type of validation: DTD or XSD)
namespaceAware whether the returned factory is to provide support for XML namespaces
Returns
  • the JAXP DocumentBuilderFactory
Throws
ParserConfigurationException if we failed to build a proper DocumentBuilderFactory