Class XmlFactory


  • public class XmlFactory
    extends java.lang.Object
    Provides helper methods for creating properly configured XML parser factory instances with namespace support turned on and configured for security.
    Author:
    snajper
    • Constructor Summary

      Constructors 
      Constructor Description
      XmlFactory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.xml.validation.SchemaFactory allowExternalAccess​(javax.xml.validation.SchemaFactory sf, java.lang.String value, boolean disableSecureProcessing)  
      static javax.xml.validation.SchemaFactory allowExternalDTDAccess​(javax.xml.validation.SchemaFactory sf, java.lang.String value, boolean disableSecureProcessing)  
      static javax.xml.parsers.DocumentBuilderFactory createDocumentBuilderFactory​(boolean disableSecureProcessing)
      Returns properly configured (e.g.
      static javax.xml.parsers.SAXParserFactory createParserFactory​(boolean disableSecureProcessing)
      Returns properly configured (e.g.
      static javax.xml.validation.SchemaFactory createSchemaFactory​(java.lang.String language, boolean disableSecureProcessing)
      Returns properly configured (e.g.
      static javax.xml.transform.TransformerFactory createTransformerFactory​(boolean disableSecureProcessing)
      Returns properly configured (e.g.
      static javax.xml.xpath.XPathFactory createXPathFactory​(boolean disableSecureProcessing)
      Returns properly configured (e.g.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ACCESS_EXTERNAL_SCHEMA

        public static final java.lang.String ACCESS_EXTERNAL_SCHEMA
        See Also:
        Constant Field Values
      • ACCESS_EXTERNAL_DTD

        public static final java.lang.String ACCESS_EXTERNAL_DTD
        See Also:
        Constant Field Values
    • Constructor Detail

      • XmlFactory

        public XmlFactory()
    • Method Detail

      • createSchemaFactory

        public static javax.xml.validation.SchemaFactory createSchemaFactory​(java.lang.String language,
                                                                             boolean disableSecureProcessing)
                                                                      throws java.lang.IllegalStateException
        Returns properly configured (e.g. security features) schema factory - namespaceAware == true - securityProcessing == is set based on security processing property, default is true
        Throws:
        java.lang.IllegalStateException
      • createParserFactory

        public static javax.xml.parsers.SAXParserFactory createParserFactory​(boolean disableSecureProcessing)
                                                                      throws java.lang.IllegalStateException
        Returns properly configured (e.g. security features) parser factory - namespaceAware == true - securityProcessing == is set based on security processing property, default is true
        Throws:
        java.lang.IllegalStateException
      • createXPathFactory

        public static javax.xml.xpath.XPathFactory createXPathFactory​(boolean disableSecureProcessing)
                                                               throws java.lang.IllegalStateException
        Returns properly configured (e.g. security features) factory - securityProcessing == is set based on security processing property, default is true
        Throws:
        java.lang.IllegalStateException
      • createTransformerFactory

        public static javax.xml.transform.TransformerFactory createTransformerFactory​(boolean disableSecureProcessing)
                                                                               throws java.lang.IllegalStateException
        Returns properly configured (e.g. security features) factory - securityProcessing == is set based on security processing property, default is true
        Throws:
        java.lang.IllegalStateException
      • createDocumentBuilderFactory

        public static javax.xml.parsers.DocumentBuilderFactory createDocumentBuilderFactory​(boolean disableSecureProcessing)
                                                                                     throws java.lang.IllegalStateException
        Returns properly configured (e.g. security features) factory - namespaceAware == true - securityProcessing == is set based on security processing property, default is true
        Throws:
        java.lang.IllegalStateException
      • allowExternalAccess

        public static javax.xml.validation.SchemaFactory allowExternalAccess​(javax.xml.validation.SchemaFactory sf,
                                                                             java.lang.String value,
                                                                             boolean disableSecureProcessing)
      • allowExternalDTDAccess

        public static javax.xml.validation.SchemaFactory allowExternalDTDAccess​(javax.xml.validation.SchemaFactory sf,
                                                                                java.lang.String value,
                                                                                boolean disableSecureProcessing)