public class DocumentBuilderFactoryBuilder
extends java.lang.Object
DocumentBuilderFactory
.
Note that unless explicitly specified then the corresponding DocumentBuilderFactory
will
not have its corresponding setter called.
In the adapter configuration file this class is aliased as xml-document-builder-configuration which is the preferred alternative to the fully qualified classname when building your configuration.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DISABLE_DOCTYP |
Constructor and Description |
---|
DocumentBuilderFactoryBuilder() |
Modifier and Type | Method and Description |
---|---|
DocumentBuilderFactoryBuilder |
addFeature(java.lang.String featureName,
java.lang.Boolean value) |
javax.xml.parsers.DocumentBuilderFactory |
build()
Create a
DocumentBuilderFactory . |
javax.xml.parsers.DocumentBuilder |
configure(javax.xml.parsers.DocumentBuilder db)
Configure a document builder.
|
javax.xml.parsers.DocumentBuilderFactory |
configure(javax.xml.parsers.DocumentBuilderFactory f)
Configure a document builder factory
|
java.lang.Boolean |
getCoalescing()
Calls
DocumentBuilderFactory.setCoalescing(boolean) if non-null |
org.xml.sax.EntityResolver |
getEntityResolver()
Calls
DocumentBuilder.setEntityResolver(EntityResolver) if non-null. |
java.lang.Boolean |
getExpandEntityReferences()
Calls
DocumentBuilderFactory.setExpandEntityReferences(boolean) if non-null |
@NonNull KeyValuePairSet |
getFeatures()
Calls
DocumentBuilderFactory.setFeature(String, boolean) for each value defined. |
java.lang.Boolean |
getIgnoreComments()
Calls
DocumentBuilderFactory.setIgnoringComments(boolean) if non-null |
java.lang.Boolean |
getIgnoreWhitespace()
Calls
DocumentBuilderFactory.setIgnoringElementContentWhitespace(boolean) if non-null |
java.lang.Boolean |
getNamespaceAware()
Calls
DocumentBuilderFactory.setNamespaceAware(boolean) if non null |
java.lang.Boolean |
getValidating()
Calls
DocumentBuilderFactory.setValidating(boolean) if non-null |
java.lang.Boolean |
getXincludeAware()
Calls
DocumentBuilderFactory.setXIncludeAware(boolean) if non-null |
javax.xml.parsers.DocumentBuilder |
newDocumentBuilder(javax.xml.parsers.DocumentBuilderFactory f)
Convenience to create a new
DocumentBuilder instance. |
static DocumentBuilderFactoryBuilder |
newInstance()
Create a new instance that is namespace aware.
|
static DocumentBuilderFactoryBuilder |
newInstanceIfNull(DocumentBuilderFactoryBuilder b) |
static DocumentBuilderFactoryBuilder |
newInstanceIfNull(DocumentBuilderFactoryBuilder b,
javax.xml.namespace.NamespaceContext ctx) |
static DocumentBuilderFactoryBuilder |
newRestrictedInstance()
Create a New instance that disables Entityrefs and also mitigates against XXE via
http://apache.org/xml/features/disallow-doctype-decl = true . |
static DocumentBuilderFactoryBuilder |
newRestrictedInstanceIfNull(DocumentBuilderFactoryBuilder b) |
void |
setCoalescing(java.lang.Boolean coalescing)
Calls
DocumentBuilderFactory.setCoalescing(boolean) if non-null |
void |
setEntityResolver(org.xml.sax.EntityResolver entityResolver)
Calls
DocumentBuilder.setEntityResolver(EntityResolver) if non-null. |
void |
setExpandEntityReferences(java.lang.Boolean expandEntityReferences)
Calls
DocumentBuilderFactory.setExpandEntityReferences(boolean) if non-null |
void |
setFeatures(@NonNull KeyValuePairSet features)
Calls
DocumentBuilderFactory.setFeature(String, boolean) for each value defined. |
void |
setIgnoreComments(java.lang.Boolean ignoreComments)
Calls
DocumentBuilderFactory.setIgnoringComments(boolean) if non-null |
void |
setIgnoreWhitespace(java.lang.Boolean ignoreWhitespace)
Calls
DocumentBuilderFactory.setIgnoringElementContentWhitespace(boolean) if non-null |
void |
setNamespaceAware(java.lang.Boolean namespaceAware)
Calls
DocumentBuilderFactory.setNamespaceAware(boolean) if non null |
void |
setValidating(java.lang.Boolean validating)
Calls
DocumentBuilderFactory.setValidating(boolean) if non-null |
void |
setXincludeAware(java.lang.Boolean xincludeAware)
Calls
DocumentBuilderFactory.setXIncludeAware(boolean) if non-null |
DocumentBuilderFactoryBuilder |
withCoalescing(java.lang.Boolean b) |
DocumentBuilderFactoryBuilder |
withEntityResolver(org.xml.sax.EntityResolver e) |
DocumentBuilderFactoryBuilder |
withExpandEntityReferences(java.lang.Boolean b) |
DocumentBuilderFactoryBuilder |
withFeatures(KeyValuePairSet v) |
DocumentBuilderFactoryBuilder |
withFeatures(java.util.Map<java.lang.String,java.lang.Boolean> f) |
DocumentBuilderFactoryBuilder |
withIgnoreComments(java.lang.Boolean b) |
DocumentBuilderFactoryBuilder |
withIgnoreWhitespace(java.lang.Boolean b) |
DocumentBuilderFactoryBuilder |
withNamespaceAware(java.lang.Boolean b) |
DocumentBuilderFactoryBuilder |
withNamespaceAware(javax.xml.namespace.NamespaceContext b) |
DocumentBuilderFactoryBuilder |
withValidating(java.lang.Boolean b) |
DocumentBuilderFactoryBuilder |
withXIncludeAware(java.lang.Boolean b) |
public static final java.lang.String DISABLE_DOCTYP
public static final DocumentBuilderFactoryBuilder newInstance()
public static final DocumentBuilderFactoryBuilder newRestrictedInstance()
http://apache.org/xml/features/disallow-doctype-decl = true
. This is added as a convenience so you don't have to keep
configuring it if XXE is a bit of a bother for you.public static final DocumentBuilderFactoryBuilder newInstanceIfNull(DocumentBuilderFactoryBuilder b)
public static final DocumentBuilderFactoryBuilder newRestrictedInstanceIfNull(DocumentBuilderFactoryBuilder b)
public static final DocumentBuilderFactoryBuilder newInstanceIfNull(DocumentBuilderFactoryBuilder b, javax.xml.namespace.NamespaceContext ctx)
public javax.xml.parsers.DocumentBuilderFactory configure(javax.xml.parsers.DocumentBuilderFactory f) throws javax.xml.parsers.ParserConfigurationException
f
- javax.xml.parsers.ParserConfigurationException
public javax.xml.parsers.DocumentBuilder configure(javax.xml.parsers.DocumentBuilder db)
db
- public javax.xml.parsers.DocumentBuilder newDocumentBuilder(javax.xml.parsers.DocumentBuilderFactory f) throws javax.xml.parsers.ParserConfigurationException
DocumentBuilder
instance.f
- a DocumentBuilderFactoryjavax.xml.parsers.ParserConfigurationException
configure(DocumentBuilder)
,
configure(DocumentBuilderFactory)
public javax.xml.parsers.DocumentBuilderFactory build() throws javax.xml.parsers.ParserConfigurationException
DocumentBuilderFactory
.
If all you're doing is creating a DocumentBuilder
straight after calling this method,
don't forget to call configure(DocumentBuilder)
to make sure you configure the
underlying DocumentBuilder
with any configured getEntityResolver()
.
javax.xml.parsers.ParserConfigurationException
public DocumentBuilderFactoryBuilder withFeatures(java.util.Map<java.lang.String,java.lang.Boolean> f)
public DocumentBuilderFactoryBuilder withFeatures(KeyValuePairSet v)
public DocumentBuilderFactoryBuilder addFeature(java.lang.String featureName, java.lang.Boolean value)
public DocumentBuilderFactoryBuilder withValidating(java.lang.Boolean b)
public DocumentBuilderFactoryBuilder withNamespaceAware(java.lang.Boolean b)
public DocumentBuilderFactoryBuilder withNamespaceAware(javax.xml.namespace.NamespaceContext b)
public DocumentBuilderFactoryBuilder withIgnoreWhitespace(java.lang.Boolean b)
public DocumentBuilderFactoryBuilder withExpandEntityReferences(java.lang.Boolean b)
public DocumentBuilderFactoryBuilder withIgnoreComments(java.lang.Boolean b)
public DocumentBuilderFactoryBuilder withCoalescing(java.lang.Boolean b)
public DocumentBuilderFactoryBuilder withXIncludeAware(java.lang.Boolean b)
public DocumentBuilderFactoryBuilder withEntityResolver(org.xml.sax.EntityResolver e)
@NonNull public @NonNull KeyValuePairSet getFeatures()
DocumentBuilderFactory.setFeature(String, boolean)
for each value defined.
No validation of the features is done and are passed as-is through to the underlying DocumentBuilderFactory.
public void setFeatures(@NonNull @NonNull KeyValuePairSet features)
DocumentBuilderFactory.setFeature(String, boolean)
for each value defined.
No validation of the features is done and are passed as-is through to the underlying DocumentBuilderFactory.
public java.lang.Boolean getValidating()
DocumentBuilderFactory.setValidating(boolean)
if non-nullpublic void setValidating(java.lang.Boolean validating)
DocumentBuilderFactory.setValidating(boolean)
if non-nullpublic java.lang.Boolean getNamespaceAware()
DocumentBuilderFactory.setNamespaceAware(boolean)
if non nullpublic void setNamespaceAware(java.lang.Boolean namespaceAware)
DocumentBuilderFactory.setNamespaceAware(boolean)
if non nullpublic java.lang.Boolean getIgnoreWhitespace()
DocumentBuilderFactory.setIgnoringElementContentWhitespace(boolean)
if non-nullpublic void setIgnoreWhitespace(java.lang.Boolean ignoreWhitespace)
DocumentBuilderFactory.setIgnoringElementContentWhitespace(boolean)
if non-nullpublic java.lang.Boolean getExpandEntityReferences()
DocumentBuilderFactory.setExpandEntityReferences(boolean)
if non-nullpublic void setExpandEntityReferences(java.lang.Boolean expandEntityReferences)
DocumentBuilderFactory.setExpandEntityReferences(boolean)
if non-nullpublic java.lang.Boolean getIgnoreComments()
DocumentBuilderFactory.setIgnoringComments(boolean)
if non-nullpublic void setIgnoreComments(java.lang.Boolean ignoreComments)
DocumentBuilderFactory.setIgnoringComments(boolean)
if non-nullpublic java.lang.Boolean getCoalescing()
DocumentBuilderFactory.setCoalescing(boolean)
if non-nullpublic void setCoalescing(java.lang.Boolean coalescing)
DocumentBuilderFactory.setCoalescing(boolean)
if non-nullpublic java.lang.Boolean getXincludeAware()
DocumentBuilderFactory.setXIncludeAware(boolean)
if non-nullpublic void setXincludeAware(java.lang.Boolean xincludeAware)
DocumentBuilderFactory.setXIncludeAware(boolean)
if non-nullpublic org.xml.sax.EntityResolver getEntityResolver()
DocumentBuilder.setEntityResolver(EntityResolver)
if non-null.public void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
DocumentBuilder.setEntityResolver(EntityResolver)
if non-null.