Home » Spring-Framework-090522 » org.springframework » beans » factory » xml » [javadoc | source]
public class: XmlBeanDefinitionReader [javadoc | source]

All Implemented Interfaces:

Bean definition reader for XML bean definitions. Delegates the actual XML document reading to an implementation of the BeanDefinitionDocumentReader interface.

Typically applied to a org.springframework.beans.factory.support.DefaultListableBeanFactory or a org.springframework.context.support.GenericApplicationContext .

This class loads a DOM document and applies the BeanDefinitionDocumentReader to it. The document reader will register each bean definition with the given bean factory, talking to the latter's implementation of the org.springframework.beans.factory.support.BeanDefinitionRegistry interface.

Field Summary
public static final  int VALIDATION_NONE    Indicates that the validation should be disabled. 
public static final  int VALIDATION_AUTO    Indicates that the validation mode should be detected automatically. 
public static final  int VALIDATION_DTD    Indicates that DTD validation should be used. 
public static final  int VALIDATION_XSD    Indicates that XSD validation should be used. 
Fields inherited from org.springframework.beans.factory.support.AbstractBeanDefinitionReader:
 public XmlBeanDefinitionReader(BeanDefinitionRegistry registry) 
    Create new XmlBeanDefinitionReader for the given bean factory.
    registry - the BeanFactory to load bean definitions into, in the form of a BeanDefinitionRegistry
Method from org.springframework.beans.factory.xml.XmlBeanDefinitionReader Summary:
createBeanDefinitionDocumentReader,   createDefaultNamespaceHandlerResolver,   createReaderContext,   detectValidationMode,   doLoadBeanDefinitions,   getEntityResolver,   getValidationMode,   getValidationModeForResource,   isNamespaceAware,   loadBeanDefinitions,   loadBeanDefinitions,   loadBeanDefinitions,   loadBeanDefinitions,   registerBeanDefinitions,   setDocumentLoader,   setDocumentReaderClass,   setEntityResolver,   setErrorHandler,   setEventListener,   setNamespaceAware,   setNamespaceHandlerResolver,   setParserClass,   setProblemReporter,   setSourceExtractor,   setValidating,   setValidationMode,   setValidationModeName
Methods from org.springframework.beans.factory.support.AbstractBeanDefinitionReader:
getBeanClassLoader,   getBeanFactory,   getBeanNameGenerator,   getRegistry,   getResourceLoader,   loadBeanDefinitions,   loadBeanDefinitions,   loadBeanDefinitions,   loadBeanDefinitions,   setBeanClassLoader,   setBeanNameGenerator,   setResourceLoader
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.beans.factory.xml.XmlBeanDefinitionReader Detail:
 protected BeanDefinitionDocumentReader createBeanDefinitionDocumentReader() 
    Create the BeanDefinitionDocumentReader to use for actually reading bean definitions from an XML document.

    Default implementation instantiates the specified "documentReaderClass".

 protected NamespaceHandlerResolver createDefaultNamespaceHandlerResolver() 
 protected XmlReaderContext createReaderContext(Resource resource) 
 protected int detectValidationMode(Resource resource) 
    Detects which kind of validation to perform on the XML file identified by the supplied Resource . If the file has a DOCTYPE definition then DTD validation is used otherwise XSD validation is assumed.

    Override this method if you would like to customize resolution of the #VALIDATION_AUTO mode.

 protected int doLoadBeanDefinitions(InputSource inputSource,
    Resource resource) throws BeanDefinitionStoreException 
    Actually load bean definitions from the specified XML file.
 protected EntityResolver getEntityResolver() 
    Return the EntityResolver to use, building a default resolver if none specified.
 public int getValidationMode() 
    Return the validation mode to use.
 protected int getValidationModeForResource(Resource resource) 
    Gets the validation mode for the specified Resource . If no explicit validation mode has been configured then the validation mode is detected .

    Override this method if you would like full control over the validation mode, even when something other than #VALIDATION_AUTO was set.

 public boolean isNamespaceAware() 
    Return whether or not the XML parser should be XML namespace aware.
 public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException 
    Load bean definitions from the specified XML file.
 public int loadBeanDefinitions(EncodedResource encodedResource) throws BeanDefinitionStoreException 
    Load bean definitions from the specified XML file.
 public int loadBeanDefinitions(InputSource inputSource) throws BeanDefinitionStoreException 
    Load bean definitions from the specified XML file.
 public int loadBeanDefinitions(InputSource inputSource,
    String resourceDescription) throws BeanDefinitionStoreException 
    Load bean definitions from the specified XML file.
 public int registerBeanDefinitions(Document doc,
    Resource resource) throws BeanDefinitionStoreException 
    Register the bean definitions contained in the given DOM document. Called by loadBeanDefinitions.

    Creates a new instance of the parser class and invokes registerBeanDefinitions on it.

 public  void setDocumentLoader(DocumentLoader documentLoader) 
 public  void setDocumentReaderClass(Class documentReaderClass) 
    Specify the BeanDefinitionDocumentReader implementation to use, responsible for the actual reading of the XML bean definition document.

    Default is DefaultBeanDefinitionDocumentReader.

 public  void setEntityResolver(EntityResolver entityResolver) 
    Set a SAX entity resolver to be used for parsing. By default, BeansDtdResolver will be used. Can be overridden for custom entity resolution, for example relative to some specific base path.
 public  void setErrorHandler(ErrorHandler errorHandler) 
    Set an implementation of the org.xml.sax.ErrorHandler interface for custom handling of XML parsing errors and warnings.

    If not set, a default SimpleSaxErrorHandler is used that simply logs warnings using the logger instance of the view class, and rethrows errors to discontinue the XML transformation.

 public  void setEventListener(ReaderEventListener eventListener) 
    Specify which ReaderEventListener to use. Default implementation is EmptyReaderEventListener which discards every event notification. External tools can provide an alternative implementation to monitor the components being registered in the BeanFactory.
 public  void setNamespaceAware(boolean namespaceAware) 
    Set whether or not the XML parser should be XML namespace aware. Default is "false".
 public  void setNamespaceHandlerResolver(NamespaceHandlerResolver namespaceHandlerResolver) 
 public  void setParserClass(Class parserClass) 
Deprecated! as - of Spring 2.0: superseded by "documentReaderClass"

    Set the XmlBeanDefinitionParser implementation to use, responsible for the actual parsing of XML bean definitions.
 public  void setProblemReporter(ProblemReporter problemReporter) 
 public  void setSourceExtractor(SourceExtractor sourceExtractor) 
    Specify the SourceExtractor to use. The default implementation is NullSourceExtractor which simply returns null as the source object. This means that during normal runtime execution no additional source metadata is attached to the bean configuration metadata.
 public  void setValidating(boolean validating) 
Deprecated! as - of Spring 2.0: superseded by "validationMode"

    Set if the XML parser should validate the document and thus enforce a DTD.
 public  void setValidationMode(int validationMode) 
 public  void setValidationModeName(String validationModeName)