Java Utililty Methods XML DocumentBuilder Create

List of utility methods to do XML DocumentBuilder Create

Description

The list of methods to do XML DocumentBuilder Create are organized into topic(s).

Method

DocumentBuildergetDocumentBuilder()
get Document Builder
if (db == null) {
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setValidating(false);
    dbf.setIgnoringComments(true);
    dbf.setFeature("http://xml.org/sax/features/namespaces", false);
    dbf.setFeature("http://xml.org/sax/features/validation", false);
    dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
    dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
...
DocumentBuildergetDocumentBuilder()
get Document Builder
DocumentBuilder builder = documentBuilder.get();
if (builder == null) {
    try {
        builder = documentBuilderFactory.newDocumentBuilder();
    } catch (ParserConfigurationException e) {
        throw new RuntimeException(e);
    documentBuilder.set(builder);
...
DocumentBuildergetDocumentBuilder(boolean NamespaceAwareness)
get Document Builder
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
domFactory.setNamespaceAware(NamespaceAwareness);
domFactory.setAttribute("http://apache.org/xml/features/dom/include-ignorable-whitespace", Boolean.FALSE);
return domFactory.newDocumentBuilder();
DocumentBuildergetDocumentBuilder(boolean secure)
get Document Builder
String feature;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
feature = "http://xml.org/sax/features/external-general-entities";
factory.setFeature(feature, false);
feature = "http://xml.org/sax/features/external-parameter-entities";
factory.setFeature(feature, false);
feature = "http://apache.org/xml/features/nonvalidating/load-external-dtd";
factory.setFeature(feature, false);
...
DocumentBuilderFactorygetDocumentBuilderFactory()
Return the document builder factory property.
return DOCUMENT_BUILDER_FACTORY;
DocumentBuilderFactorygetDocumentBuilderFactory()
get Document Builder Factory
String oldDbfImpl = System.getProperty(DBF_SYSTEM_PROPERTY);
System.setProperty(DBF_SYSTEM_PROPERTY, JAVA_INTERNAL_DBF_CLASS);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
if (oldDbfImpl != null) {
    System.setProperty(DBF_SYSTEM_PROPERTY, oldDbfImpl);
} else {
    System.getProperties().remove(DBF_SYSTEM_PROPERTY);
return dbf;
DocumentBuilderFactorygetDocumentBuilderFactory()
get Document Builder Factory
if (documentBuilderFactory == null) {
    documentBuilderFactory = DocumentBuilderFactory.newInstance();
return documentBuilderFactory;
DocumentBuilderFactorygetDocumentBuilderFactory()
Utility for accessing a consistent DocumentBuilderFactory (irregardless of what is on the classpath)
DocumentBuilderFactory factory = DocumentBuilderFactory
        .newInstance("org.apache.xerces.jaxp.DocumentBuilderFactoryImpl", null);
return factory;
DocumentBuilderFactorygetDocumentBuilderFactory()
Gets the document builder factory, creating it if necessary.
if (documentBuilderFactory == null) {
    documentBuilderFactory = DocumentBuilderFactory.newInstance();
    documentBuilderFactory.setNamespaceAware(true);
    documentBuilderFactory.setExpandEntityReferences(false);
return documentBuilderFactory;
DocumentBuilderFactorygetDocumentBuilderFactory(boolean isNamespaceAware)
get Document Builder Factory
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(isNamespaceAware);
return dbf;