站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.1.0 API 文档英文版

DefaultDocumentLoader (Spring Framework API 2.1) - Spring Framework 2.1.0 API 文档英文版


The Spring Framework

org.springframework.beans.factory.xml
Class DefaultDocumentLoader

java.lang.Object
  extended by org.springframework.beans.factory.xml.DefaultDocumentLoader
All Implemented Interfaces:
DocumentLoader

public class DefaultDocumentLoader
extends Object
implements DocumentLoader

The 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 use a Java define when starting your application. For example, to use the Oracle DocumentBuilder, one might start one's application like so:

java -Djavax.xml.parsers.DocumentBuilderFactory=oracle.xml.jaxp.JXDocumentBuilderFactory MyMainClass

Since:
2.0
Author:
Rob Harrop, Juergen Hoeller

Constructor Summary
DefaultDocumentLoader()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDocumentLoader

public DefaultDocumentLoader()
Method Detail

loadDocument

public Document loadDocument(InputSource inputSource,
                             EntityResolver entityResolver,
                             ErrorHandler errorHandler,
                             int validationMode,
                             boolean namespaceAware)
                      throws Exception
Load the Document at the supplied InputSource using the standard JAXP-configured XML parser.

Specified by:
loadDocument in interface DocumentLoader
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 the loading is provide support for XML namespaces
Returns:
the loaded document
Throws:
Exception - if an error occurs

createDocumentBuilderFactory

protected DocumentBuilderFactory createDocumentBuilderFactory(int validationMode,
                                                              boolean namespaceAware)
                                                       throws ParserConfigurationException
Create the DocumentBuilderFactory instance.

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

createDocumentBuilder

protected DocumentBuilder createDocumentBuilder(DocumentBuilderFactory factory,
                                                EntityResolver entityResolver,
                                                ErrorHandler errorHandler)
                                         throws ParserConfigurationException
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

The Spring Framework

Copyright © 2002-2007 The Spring Framework.