001/* 002 * Copyright 2002-2012 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; 020import org.xml.sax.EntityResolver; 021import org.xml.sax.ErrorHandler; 022import org.xml.sax.InputSource; 023 024/** 025 * Strategy interface for loading an XML {@link Document}. 026 * 027 * @author Rob Harrop 028 * @since 2.0 029 * @see DefaultDocumentLoader 030 */ 031public interface DocumentLoader { 032 033 /** 034 * Load a {@link Document document} from the supplied {@link InputSource source}. 035 * @param inputSource the source of the document that is to be loaded 036 * @param entityResolver the resolver that is to be used to resolve any entities 037 * @param errorHandler used to report any errors during document loading 038 * @param validationMode the type of validation 039 * {@link org.springframework.util.xml.XmlValidationModeDetector#VALIDATION_DTD DTD} 040 * or {@link org.springframework.util.xml.XmlValidationModeDetector#VALIDATION_XSD XSD}) 041 * @param namespaceAware {@code true} if support for XML namespaces is to be provided 042 * @return the loaded {@link Document document} 043 * @throws Exception if an error occurs 044 */ 045 Document loadDocument( 046 InputSource inputSource, EntityResolver entityResolver, 047 ErrorHandler errorHandler, int validationMode, boolean namespaceAware) 048 throws Exception; 049 050}