Class SecureDocumentBuilderFactory

java.lang.Object
org.apache.commons.xml.secure.SecureDocumentBuilderFactory

public final class SecureDocumentBuilderFactory extends Object
Creates new, secure DocumentBuilderFactory instances.

Beyond the three universal guarantees on org.apache.commons.xml.secure, XInclude resolution is denied by default. When setXIncludeAware(true) is called on the returned factory, the parser will process xi:include elements but every external resource lookup is rejected. To permit specific trusted resources, install an EntityResolver on the DocumentBuilder that allow-lists them; any href the resolver does not explicitly allow stays blocked.

Not a DocumentBuilderFactory itself, so none of the JAXP static factory methods is inherited: a caller cannot reach a non-secured factory through this class by calling an inherited method such as newDefaultInstance(). The secure factories are instances of a nested, non-public wrapper class.

See Also: