Class XMLUtils

java.lang.Object
org.wso2.carbon.webapp.mgt.utils.XMLUtils

public class XMLUtils extends Object
Contains XML utility methods based on DOM.
  • Constructor Details

    • XMLUtils

      public XMLUtils()
  • Method Details

    • buildDocumentFromFile

      public static Document buildDocumentFromFile(File xmlFile) throws Exception
      Build a Document from a file
      Parameters:
      xmlFile - file
      Returns:
      a Document object
      Throws:
      Exception - if an error occurs
    • buildDocumentFromInputStream

      public static Document buildDocumentFromInputStream(InputStream is) throws Exception
      Build a document from a InputStream.
      Parameters:
      is - InputStream
      Returns:
      a Document object
      Throws:
      Exception - if an error occurs
    • getSecuredDocumentBuilderFactory

      public static DocumentBuilderFactory getSecuredDocumentBuilderFactory() throws ParserConfigurationException
      Create DocumentBuilderFactory with the XXE and XEE prevention measurements.
      Returns:
      Secured DocumentBuilderFactory instance.
      Throws:
      ParserConfigurationException - When failed to load XML Processor Features external-general-entities, external-parameter-entities, nonvalidating/load-external-dtd.