Package org.forgerock.util.xml
Class XMLUtils
java.lang.Object
org.forgerock.util.xml.XMLUtils
Utility classes for handling XML.
-
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentBuilder
getSafeDocumentBuilder
(boolean validating) Provides a secure DocumentBuilder implementation, which is protected against different types of entity expansion attacks and makes sure that only locally available DTDs can be referenced within the XML document.static SAXParser
getSafeSAXParser
(boolean validating) Provides a secure SAXParser instance, which is protected against different types of entity expension, DoS attacks and makes sure that only locally available DTDs can be referenced within the XML document.
-
Method Details
-
getSafeDocumentBuilder
public static DocumentBuilder getSafeDocumentBuilder(boolean validating) throws ParserConfigurationException Provides a secure DocumentBuilder implementation, which is protected against different types of entity expansion attacks and makes sure that only locally available DTDs can be referenced within the XML document.- Parameters:
validating
- Whether the returned DocumentBuilder should validate input.- Returns:
- A secure DocumentBuilder instance.
- Throws:
ParserConfigurationException
- In case xerces does not support one of the required features.
-
getSafeSAXParser
public static SAXParser getSafeSAXParser(boolean validating) throws ParserConfigurationException, SAXException Provides a secure SAXParser instance, which is protected against different types of entity expension, DoS attacks and makes sure that only locally available DTDs can be referenced within the XML document.- Parameters:
validating
- Whether the returned DocumentBuilder should validate input.- Returns:
- A secure SAXParser instance.
- Throws:
ParserConfigurationException
- In case Xerces does not support one of the required features.SAXException
- In case Xerces does not support one of the required features.
-