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.

This class is not itself a DocumentBuilderFactory, so it inherits none of the static JAXP factory methods. A caller therefore cannot obtain an unsecured factory through this class by calling a method such as newDefaultInstance(). The secure factories are instances of a nested, non-public wrapper class.

See Also: