org.springframework.beans.factory.xml

## Interface BeanDefinitionDocumentReader

- All Known Implementing Classes:
    DefaultBeanDefinitionDocumentReader

      public interface BeanDefinitionDocumentReader

  SPI for parsing an XML document that contains Spring bean definitions. Used by XmlBeanDefinitionReader for actually parsing a DOM document.

  Instantiated per document to parse: Implementations can hold state in instance variables during the execution of the `registerBeanDefinitions` method, for example global settings that are defined for all bean definitions in the document.

  Since:
    18.12.2003
  Author:
    Juergen Hoeller, Rob Harrop
  See Also:
    `XmlBeanDefinitionReader.setDocumentReaderClass(java.lang.Class<?>)`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `registerBeanDefinitions(Document doc, XmlReaderContext readerContext)` Read bean definitions from the given DOM document and register them with the registry in the given reader context.
    `void` | `setEnvironment(Environment environment)` Set the Environment to use when reading bean definitions.

- - ### Method Detail

    - #### setEnvironment

          void setEnvironment(Environment environment)

      Set the Environment to use when reading bean definitions.

      Used for evaluating profile information to determine whether a `<beans/>` document/element should be included or ignored.

    - #### registerBeanDefinitions

          void registerBeanDefinitions(Document doc,
                                     XmlReaderContext readerContext)
                                       throws BeanDefinitionStoreException

      Read bean definitions from the given DOM document and register them with the registry in the given reader context.
      Parameters:
        `doc` - the DOM document
        `readerContext` - the current context of the reader (includes the target registry and the resource being parsed)
      Throws:
        `BeanDefinitionStoreException` - in case of parsing errors