001/*
002 * Copyright 2002-2015 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.beans.factory.xml;
018
019import org.w3c.dom.Document;
020
021import org.springframework.beans.factory.BeanDefinitionStoreException;
022
023/**
024 * SPI for parsing an XML document that contains Spring bean definitions.
025 * Used by {@link XmlBeanDefinitionReader} for actually parsing a DOM document.
026 *
027 * <p>Instantiated per document to parse: implementations can hold
028 * state in instance variables during the execution of the
029 * {@code registerBeanDefinitions} method &mdash; for example, global
030 * settings that are defined for all bean definitions in the document.
031 *
032 * @author Juergen Hoeller
033 * @author Rob Harrop
034 * @since 18.12.2003
035 * @see XmlBeanDefinitionReader#setDocumentReaderClass
036 */
037public interface BeanDefinitionDocumentReader {
038
039        /**
040         * Read bean definitions from the given DOM document and
041         * register them with the registry in the given reader context.
042         * @param doc the DOM document
043         * @param readerContext the current context of the reader
044         * (includes the target registry and the resource being parsed)
045         * @throws BeanDefinitionStoreException in case of parsing errors
046         */
047        void registerBeanDefinitions(Document doc, XmlReaderContext readerContext)
048                        throws BeanDefinitionStoreException;
049
050}