Example usage for javax.xml.parsers SAXParser isXIncludeAware

List of usage examples for javax.xml.parsers SAXParser isXIncludeAware

Introduction

In this page you can find the example usage for javax.xml.parsers SAXParser isXIncludeAware.

Prototype

public boolean isXIncludeAware() 

Source Link

Document

Get the XInclude processing mode for this parser.

Usage

From source file:org.jboss.confluence.plugin.docbook_tools.docbookimport.DocbookImporter.java

/**
 * Constructor with some checks for necessary infrastructure.
 *///from  w ww .j a  va2  s  .com
public DocbookImporter() {
    String name = transformerFact.getClass().getName();
    if (!name.contains(".xalan.")) {
        log.error("We need Xalan XSLT processor! But JAXP returned: " + name);
        throw new IllegalStateException("We need Xalan XSLT processor returned from JAXP!");
    }
    try {
        saxParserFactory.setFeature("http://apache.org/xml/features/xinclude/fixup-base-uris", false);
        SAXParser saxParser = saxParserFactory.newSAXParser();
        if (!saxParser.isXIncludeAware()) {
            throw new IllegalStateException("SAXParser returned by JAXP is not XInclude aware!");
        }
    } catch (ParserConfigurationException e) {
        log.error(e.getMessage());
        throw new RuntimeException(e);
    } catch (SAXException e) {
        log.error(e.getMessage());
        throw new RuntimeException(e);
    }
}