Class XMLUtils

java.lang.Object
org.forgerock.util.xml.XMLUtils

public final class XMLUtils extends Object
Utility classes for handling XML.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.