Search in sources :

Example 1 with ReaderConfig

use of com.ctc.wstx.api.ReaderConfig in project flink by apache.

the class Configuration method parse.

private XMLStreamReader parse(InputStream is, String systemIdStr, boolean restricted) throws IOException, XMLStreamException {
    if (!quietmode) {
        LOG.debug("parsing input stream " + is);
    }
    if (is == null) {
        return null;
    }
    SystemId systemId = SystemId.construct(systemIdStr);
    ReaderConfig readerConfig = XML_INPUT_FACTORY.createPrivateConfig();
    if (restricted) {
        readerConfig.setProperty(XMLInputFactory.SUPPORT_DTD, false);
    }
    return XML_INPUT_FACTORY.createSR(readerConfig, systemId, StreamBootstrapper.getInstance(null, systemId, is), false, true);
}
Also used : ReaderConfig(com.ctc.wstx.api.ReaderConfig) SystemId(com.ctc.wstx.io.SystemId)

Example 2 with ReaderConfig

use of com.ctc.wstx.api.ReaderConfig in project iaf by ibissource.

the class XmlUtils method getVersionInfo.

public static Map<String, String> getVersionInfo() {
    Map<String, String> map = new LinkedHashMap<>();
    SAXParserFactory spFactory = getSAXParserFactory();
    map.put("SAXParserFactory-class", spFactory.getClass().getName());
    DocumentBuilderFactory domFactory1 = getDocumentBuilderFactory(false);
    map.put("DocumentBuilderFactory1-class", domFactory1.getClass().getName());
    DocumentBuilderFactory domFactory2 = getDocumentBuilderFactory(true);
    map.put("DocumentBuilderFactory2-class", domFactory2.getClass().getName());
    TransformerFactory tFactory1 = getTransformerFactory(1);
    map.put("TransformerFactory1-class", tFactory1.getClass().getName());
    TransformerFactory tFactory2 = getTransformerFactory(2);
    map.put("TransformerFactory2-class", tFactory2.getClass().getName());
    XMLEventFactory xmlEventFactory = XMLEventFactory.newInstance();
    map.put("XMLEventFactory-class", xmlEventFactory.getClass().getName());
    XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
    map.put("XMLInputFactory-class", xmlInputFactory.getClass().getName());
    XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newInstance();
    map.put("XMLOutputFactory-class", xmlOutputFactory.getClass().getName());
    try {
        MessageFactory messageFactory = MessageFactory.newInstance();
        map.put("MessageFactory-class", messageFactory.getClass().getName());
    } catch (SOAPException e) {
        log.warn("unable to create MessageFactory", e);
        map.put("MessageFactory-class", "unable to create MessageFactory (" + e.getClass().getName() + "): " + e.getMessage() + ")");
    }
    try {
        map.put("Xerces-Version", org.apache.xerces.impl.Version.getVersion());
    } catch (Throwable t) {
        log.warn("could not get Xerces version", t);
        map.put("Xerces-Version", "not found (" + t.getClass().getName() + "): " + t.getMessage() + ")");
    }
    try {
        String xalanVersion = org.apache.xalan.Version.getVersion();
        map.put("Xalan-Version", xalanVersion);
    } catch (Throwable t) {
        log.warn("could not get Xalan version", t);
        map.put("Xalan-Version", "not found (" + t.getClass().getName() + "): " + t.getMessage() + ")");
    }
    try {
        String saxonVersion = net.sf.saxon.Version.getProductTitle();
        map.put("Saxon-Version", saxonVersion);
    } catch (Throwable t) {
        log.warn("could not get Saxon version", t);
        map.put("Saxon-Version", "not found (" + t.getClass().getName() + "): " + t.getMessage() + ")");
    }
    try {
        if (xmlInputFactory instanceof WstxInputFactory) {
            ReaderConfig woodstoxConfig = ((WstxInputFactory) xmlInputFactory).createPrivateConfig();
            String woodstoxVersion = ReaderConfig.getImplName() + " " + ReaderConfig.getImplVersion() + "; xml1.1 " + (woodstoxConfig.isXml11() ? "" : "not ") + "enabled";
            map.put("Woodstox-Version", woodstoxVersion);
        }
    } catch (Throwable t) {
        log.warn("could not get Woodstox version", t);
        map.put("Woodstox-Version", "not found (" + t.getClass().getName() + "): " + t.getMessage() + ")");
    }
    return map;
}
Also used : XMLOutputFactory(javax.xml.stream.XMLOutputFactory) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) TransformerFactory(javax.xml.transform.TransformerFactory) MessageFactory(javax.xml.soap.MessageFactory) XMLEventFactory(javax.xml.stream.XMLEventFactory) WstxInputFactory(com.ctc.wstx.stax.WstxInputFactory) LinkedHashMap(java.util.LinkedHashMap) SOAPException(javax.xml.soap.SOAPException) ReaderConfig(com.ctc.wstx.api.ReaderConfig) XMLInputFactory(javax.xml.stream.XMLInputFactory) SAXParserFactory(javax.xml.parsers.SAXParserFactory)

Example 3 with ReaderConfig

use of com.ctc.wstx.api.ReaderConfig in project iaf by ibissource.

the class StaxParserFactory method createPrivateConfig.

/**
 * Enable XML 1.1, to avoid errors like:
 * Illegal character entity: expansion character (code 0x3 at [row,col {unknown-source}]: [1,53]
 */
@Override
public ReaderConfig createPrivateConfig() {
    ReaderConfig result = super.createPrivateConfig();
    result.enableXml11(true);
    return result;
}
Also used : ReaderConfig(com.ctc.wstx.api.ReaderConfig)

Aggregations

ReaderConfig (com.ctc.wstx.api.ReaderConfig)3 SystemId (com.ctc.wstx.io.SystemId)1 WstxInputFactory (com.ctc.wstx.stax.WstxInputFactory)1 LinkedHashMap (java.util.LinkedHashMap)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 SAXParserFactory (javax.xml.parsers.SAXParserFactory)1 MessageFactory (javax.xml.soap.MessageFactory)1 SOAPException (javax.xml.soap.SOAPException)1 XMLEventFactory (javax.xml.stream.XMLEventFactory)1 XMLInputFactory (javax.xml.stream.XMLInputFactory)1 XMLOutputFactory (javax.xml.stream.XMLOutputFactory)1 TransformerFactory (javax.xml.transform.TransformerFactory)1