Class XmlFactory


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

      • createSchemaFactory

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

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

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

        public static TransformerFactory createTransformerFactory​(boolean disableSecureProcessing)
                                                           throws IllegalStateException
        Returns properly configured (e.g., security features) factory - securityProcessing == is set based on security processing property, default is true
        Parameters:
        disableSecureProcessing - disable secure processing in TransformerFactory
        Returns:
        TransformerFactory new instance
        Throws:
        IllegalStateException - error on configuring TransformerFactory
      • createTransformerFactory

        public static TransformerFactory createTransformerFactory​(boolean disableSecureProcessing,
                                                                  boolean useCache)
                                                           throws IllegalStateException
        Returns properly configured (e.g., security features) factory - securityProcessing == is set based on security processing property, default is true
        Parameters:
        disableSecureProcessing - disable secure processing in TransformerFactory
        useCache - use cached instances of TransformerFactory, false will always create new ones
        Returns:
        TransformerFactory new instance or cached one if useCache is true and found in cache
        Throws:
        IllegalStateException - error on configuring TransformerFactory
      • createDocumentBuilderFactory

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