1 /* 2 * Copyright 2002-2006 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.springframework.beans.factory.xml; 18 19 import org.w3c.dom.Document; 20 21 import org.springframework.beans.factory.BeanDefinitionStoreException; 22 import org.springframework.beans.factory.support.BeanDefinitionReader; 23 import org.springframework.core.io.Resource; 24 25 /** 26 * Strategy interface for parsing XML bean definitions. 27 * Used by XmlBeanDefinitionReader for actually parsing a DOM document. 28 * 29 * <p>Instantiated per document to parse: Implementations can hold 30 * state in instance variables during the execution of the 31 * <code>registerBeanDefinitions</code> method, for example global 32 * settings that are defined for all bean definitions in the document. 33 * 34 * @author Juergen Hoeller 35 * @since 18.12.2003 36 * @deprecated as of Spring 2.0: superseded by BeanDefinitionDocumentReader 37 * @see BeanDefinitionDocumentReader 38 * @see XmlBeanDefinitionReader#setParserClass 39 */ 40 public interface XmlBeanDefinitionParser { 41 42 /** 43 * Parse bean definitions from the given DOM document, 44 * and register them with the given bean factory. 45 * @param reader the bean definition reader, containing the bean factory 46 * to work on and the bean class loader to use. Can also be used to load 47 * further bean definition files referenced by the given document. 48 * @param doc the DOM document 49 * @param resource descriptor of the original XML resource 50 * (useful for displaying parse errors) 51 * @return the number of bean definitions found 52 * @throws BeanDefinitionStoreException in case of parsing errors 53 */ 54 int registerBeanDefinitions(BeanDefinitionReader reader, Document doc, Resource resource) 55 throws BeanDefinitionStoreException; 56 57 } 58