Module xml.base

Class DocumentBuilderFactoryInitializer


  • public class DocumentBuilderFactoryInitializer
    extends java.lang.Object
    The class DocumentBuilderFactoryInitializer provides method for initialize DocumentBuilderFactory, DocumentBuilder, Document and DOMSource objects
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.w3c.dom.Document newDocument​(java.io.File xml)
      Gets the Document from the given xml file
      static org.w3c.dom.Document newDocument​(java.lang.String xml)
      Gets the Document from the given xml string
      static javax.xml.parsers.DocumentBuilder newDocumentBuilder()
      Factory method for create a new DocumentBuilder object
      static javax.xml.parsers.DocumentBuilder newDocumentBuilder​(java.lang.String schema)
      Factory method for create a new DocumentBuilder object
      static javax.xml.parsers.DocumentBuilderFactory newDocumentBuilderFactory​(java.lang.String schema)
      Factory method for create a new DocumentBuilderFactory object
      static javax.xml.parsers.DocumentBuilderFactory newDocumentBuilderFactory​(java.lang.String schema, java.lang.String schemaLanguage, java.lang.String documentBuilderFactoryName, boolean namespaceAwareness, boolean factoryValidating)
      Factory method for create a new DocumentBuilderFactory object
      static javax.xml.transform.dom.DOMSource newDOMSource​(java.io.File xml, org.xml.sax.ErrorHandler errorHandler)
      Factory method for create a new DOMSource object with the given error handler
      static org.w3c.dom.Document parse​(java.io.File xml, org.xml.sax.ErrorHandler errorHandler)
      Parses the given xml file and the given error handler
      • Methods inherited from class java.lang.Object

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

      • DocumentBuilderFactoryInitializer

        public DocumentBuilderFactoryInitializer()
    • Method Detail

      • newDocumentBuilderFactory

        public static javax.xml.parsers.DocumentBuilderFactory newDocumentBuilderFactory​(java.lang.String schema,
                                                                                         java.lang.String schemaLanguage,
                                                                                         java.lang.String documentBuilderFactoryName,
                                                                                         boolean namespaceAwareness,
                                                                                         boolean factoryValidating)
        Factory method for create a new DocumentBuilderFactory object
        Parameters:
        schema - the schema
        schemaLanguage - the schema language
        documentBuilderFactoryName - the name of the document builder factory
        namespaceAwareness - the flag if the namespace should be aware
        factoryValidating - the flag if the factory should validate
        Returns:
        the document builder factory
      • newDocumentBuilderFactory

        public static javax.xml.parsers.DocumentBuilderFactory newDocumentBuilderFactory​(java.lang.String schema)
        Factory method for create a new DocumentBuilderFactory object
        Parameters:
        schema - the schema
        Returns:
        the document builder factory
      • newDocumentBuilder

        public static javax.xml.parsers.DocumentBuilder newDocumentBuilder​(java.lang.String schema)
                                                                    throws javax.xml.parsers.ParserConfigurationException
        Factory method for create a new DocumentBuilder object
        Parameters:
        schema - the schema
        Throws:
        javax.xml.parsers.ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested.
      • newDocumentBuilder

        public static javax.xml.parsers.DocumentBuilder newDocumentBuilder()
                                                                    throws javax.xml.parsers.ParserConfigurationException
        Factory method for create a new DocumentBuilder object
        Throws:
        javax.xml.parsers.ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested.
      • newDocument

        public static org.w3c.dom.Document newDocument​(java.io.File xml)
                                                throws javax.xml.parsers.ParserConfigurationException,
                                                       org.xml.sax.SAXException,
                                                       java.io.IOException
        Gets the Document from the given xml file
        Parameters:
        xml - the xml file as string
        Returns:
        the node list
        Throws:
        javax.xml.parsers.ParserConfigurationException - the parser configuration exception
        org.xml.sax.SAXException - is thrown if a sax parse error occurs
        java.io.IOException - Signals that an I/O exception has occurred.
      • newDocument

        public static org.w3c.dom.Document newDocument​(java.lang.String xml)
                                                throws javax.xml.parsers.ParserConfigurationException,
                                                       org.xml.sax.SAXException,
                                                       java.io.IOException
        Gets the Document from the given xml string
        Parameters:
        xml - the xml file as string
        Returns:
        the node list
        Throws:
        javax.xml.parsers.ParserConfigurationException - the parser configuration exception
        org.xml.sax.SAXException - is thrown if a sax parse error occurs
        java.io.IOException - Signals that an I/O exception has occurred.
      • parse

        public static org.w3c.dom.Document parse​(java.io.File xml,
                                                 org.xml.sax.ErrorHandler errorHandler)
                                          throws org.xml.sax.SAXException,
                                                 javax.xml.parsers.ParserConfigurationException,
                                                 java.io.IOException
        Parses the given xml file and the given error handler
        Parameters:
        xml - the xml
        errorHandler - the error handler
        Returns:
        the document
        Throws:
        org.xml.sax.SAXException - If a SAX error occurs during parsing.
        javax.xml.parsers.ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested.
        java.io.IOException - Signals that an I/O exception has occurred.
      • newDOMSource

        public static javax.xml.transform.dom.DOMSource newDOMSource​(java.io.File xml,
                                                                     org.xml.sax.ErrorHandler errorHandler)
                                                              throws org.xml.sax.SAXException,
                                                                     javax.xml.parsers.ParserConfigurationException,
                                                                     java.io.IOException
        Factory method for create a new DOMSource object with the given error handler
        Parameters:
        xml - the xml
        errorHandler - the error handler
        Returns:
        the dOM source
        Throws:
        org.xml.sax.SAXException - If a SAX error occurs during parsing.
        javax.xml.parsers.ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested.
        java.io.IOException - Signals that an I/O exception has occurred.