- java.lang.Object
-
- io.github.astrapi69.xml.parser.DocumentBuilderFactoryInitializer
-
public class DocumentBuilderFactoryInitializer extends java.lang.ObjectThe classDocumentBuilderFactoryInitializerprovides method for initializeDocumentBuilderFactory,DocumentBuilder,DocumentandDOMSourceobjects
-
-
Constructor Summary
Constructors Constructor Description DocumentBuilderFactoryInitializer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.w3c.dom.DocumentnewDocument(java.io.File xml)Gets theDocumentfrom the given xml filestatic org.w3c.dom.DocumentnewDocument(java.lang.String xml)Gets theDocumentfrom the given xml stringstatic javax.xml.parsers.DocumentBuildernewDocumentBuilder()Factory method for create a newDocumentBuilderobjectstatic javax.xml.parsers.DocumentBuildernewDocumentBuilder(java.lang.String schema)Factory method for create a newDocumentBuilderobjectstatic javax.xml.parsers.DocumentBuilderFactorynewDocumentBuilderFactory(java.lang.String schema)Factory method for create a newDocumentBuilderFactoryobjectstatic javax.xml.parsers.DocumentBuilderFactorynewDocumentBuilderFactory(java.lang.String schema, java.lang.String schemaLanguage, java.lang.String documentBuilderFactoryName, boolean namespaceAwareness, boolean factoryValidating)Factory method for create a newDocumentBuilderFactoryobjectstatic javax.xml.transform.dom.DOMSourcenewDOMSource(java.io.File xml, org.xml.sax.ErrorHandler errorHandler)Factory method for create a newDOMSourceobject with the given error handlerstatic org.w3c.dom.Documentparse(java.io.File xml, org.xml.sax.ErrorHandler errorHandler)Parses the given xml file and the given error handler
-
-
-
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 newDocumentBuilderFactoryobject- Parameters:
schema- the schemaschemaLanguage- the schema languagedocumentBuilderFactoryName- the name of the document builder factorynamespaceAwareness- the flag if the namespace should be awarefactoryValidating- 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 newDocumentBuilderFactoryobject- 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.ParserConfigurationExceptionFactory method for create a newDocumentBuilderobject- 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.ParserConfigurationExceptionFactory method for create a newDocumentBuilderobject- 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.IOExceptionGets theDocumentfrom the given xml file- Parameters:
xml- the xml file as string- Returns:
- the node list
- Throws:
javax.xml.parsers.ParserConfigurationException- the parser configuration exceptionorg.xml.sax.SAXException- is thrown if a sax parse error occursjava.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.IOExceptionGets theDocumentfrom the given xml string- Parameters:
xml- the xml file as string- Returns:
- the node list
- Throws:
javax.xml.parsers.ParserConfigurationException- the parser configuration exceptionorg.xml.sax.SAXException- is thrown if a sax parse error occursjava.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.IOExceptionParses the given xml file and the given error handler- Parameters:
xml- the xmlerrorHandler- 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.IOExceptionFactory method for create a newDOMSourceobject with the given error handler- Parameters:
xml- the xmlerrorHandler- 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.
-
-