public class XmlFactories extends Object
Modifier and Type | Method and Description |
---|---|
static DocumentBuilder |
newDocumentBuilder()
Returns a document builder configured to mitigate the risk of XML External Entity (XXE) attacks.
|
static DocumentBuilder |
newDocumentBuilder(DocumentBuilderFactory factory)
Returns a document builder configured to mitigate the risk of XML External Entity (XXE) attacks,
based on the given builder factory.
|
static DocumentBuilderFactory |
newDocumentBuilderFactory()
Returns a document builder factory configured to mitigate the risk of XML External Entity (XXE) attacks.
|
static SAXParserFactory |
newSAXParserFactory()
Returns a
SAXParseFactory configured to mitigate the risk of XML External Entity (XXE) attacks. |
static TransformerFactory |
newTransformerFactory()
Returns a transformer factory configured to mitigate the risk of XML External Entity (XXE) attacks.
|
public static DocumentBuilderFactory newDocumentBuilderFactory()
Clients are recommended to directly use newDocumentBuilder()
when no additional configuration is to perform on the factory.
newDocumentBuilder()
public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException
ParserConfigurationException
- if a DocumentBuilder cannot be created which satisfies the configuration requested.public static DocumentBuilder newDocumentBuilder(DocumentBuilderFactory factory) throws ParserConfigurationException
Clients are recommended to directly use newDocumentBuilder()
when no additional configuration is to perform on the factory.
factory
- the factory to create a document builder.ParserConfigurationException
- if a DocumentBuildercannot be created which satisfies the configuration requested.newDocumentBuilder()
public static SAXParserFactory newSAXParserFactory()
SAXParseFactory
configured to mitigate the risk of XML External Entity (XXE) attacks.public static TransformerFactory newTransformerFactory()