Class XMLHelper

java.lang.Object
org.docx4j.org.apache.poi.util.XMLHelper

@Internal
public final class XMLHelper
extends java.lang.Object
Helper methods for working with javax.xml classes.
See Also:
OWASP XXE
  • Method Summary

    Modifier and Type Method Description
    static javax.xml.parsers.DocumentBuilderFactory getDocumentBuilderFactory()
    Creates a new DocumentBuilderFactory, with sensible defaults
    static javax.xml.parsers.SAXParserFactory getSaxParserFactory()  
    static javax.xml.validation.SchemaFactory getSchemaFactory()  
    static javax.xml.transform.TransformerFactory getTransformerFactory()  
    static javax.xml.parsers.DocumentBuilder newDocumentBuilder()
    Creates a new document builder, with sensible defaults
    static javax.xml.transform.Transformer newTransformer()  
    static javax.xml.stream.XMLEventFactory newXMLEventFactory()
    Creates a new StAX XMLEventFactory, with sensible defaults
    static javax.xml.stream.XMLInputFactory newXMLInputFactory()
    Creates a new StAX XMLInputFactory, with sensible defaults
    static javax.xml.stream.XMLOutputFactory newXMLOutputFactory()
    Creates a new StAX XMLOutputFactory, with sensible defaults
    static org.xml.sax.XMLReader newXMLReader()
    Creates a new SAX XMLReader, with sensible defaults

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getDocumentBuilderFactory

      public static javax.xml.parsers.DocumentBuilderFactory getDocumentBuilderFactory()
      Creates a new DocumentBuilderFactory, with sensible defaults
    • newDocumentBuilder

      public static javax.xml.parsers.DocumentBuilder newDocumentBuilder()
      Creates a new document builder, with sensible defaults
      Throws:
      java.lang.IllegalStateException - If creating the DocumentBuilder fails, e.g. due to ParserConfigurationException.
    • getSaxParserFactory

      public static javax.xml.parsers.SAXParserFactory getSaxParserFactory()
    • newXMLReader

      public static org.xml.sax.XMLReader newXMLReader() throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
      Creates a new SAX XMLReader, with sensible defaults
      Throws:
      org.xml.sax.SAXException
      javax.xml.parsers.ParserConfigurationException
    • newXMLInputFactory

      public static javax.xml.stream.XMLInputFactory newXMLInputFactory()
      Creates a new StAX XMLInputFactory, with sensible defaults
    • newXMLOutputFactory

      public static javax.xml.stream.XMLOutputFactory newXMLOutputFactory()
      Creates a new StAX XMLOutputFactory, with sensible defaults
    • newXMLEventFactory

      public static javax.xml.stream.XMLEventFactory newXMLEventFactory()
      Creates a new StAX XMLEventFactory, with sensible defaults
    • getTransformerFactory

      public static javax.xml.transform.TransformerFactory getTransformerFactory()
    • newTransformer

      public static javax.xml.transform.Transformer newTransformer() throws javax.xml.transform.TransformerConfigurationException
      Throws:
      javax.xml.transform.TransformerConfigurationException
    • getSchemaFactory

      public static javax.xml.validation.SchemaFactory getSchemaFactory()