Example usage for org.springframework.beans.factory.xml DefaultDocumentLoader loadDocument

List of usage examples for org.springframework.beans.factory.xml DefaultDocumentLoader loadDocument

Introduction

In this page you can find the example usage for org.springframework.beans.factory.xml DefaultDocumentLoader loadDocument.

Prototype

@Override
public Document loadDocument(InputSource inputSource, EntityResolver entityResolver, ErrorHandler errorHandler,
        int validationMode, boolean namespaceAware) throws Exception 

Source Link

Document

Load the Document at the supplied InputSource using the standard JAXP-configured XML parser.

Usage

From source file:org.impalaframework.util.XMLDomUtils.java

public static Document loadDocument(Reader reader, String description) {
    Document document = null;/* ww  w  . j av a2  s.  c o m*/
    DefaultDocumentLoader loader = new DefaultDocumentLoader();
    try {
        InputSource inputSource = new InputSource(reader);
        document = loader.loadDocument(inputSource, null, new SimpleSaxErrorHandler(logger),
                XmlBeanDefinitionReader.VALIDATION_NONE, true);
    } catch (Exception e) {
        throw new ExecutionException("Unable to load XML document from resource " + description, e);
    } finally {
        try {
            if (reader != null) {
                reader.close();
            }
        } catch (IOException e) {
        }
    }
    return document;
}