Class DOMUtilities

java.lang.Object
org.pentaho.reporting.tools.configeditor.util.DOMUtilities

public final class DOMUtilities extends Object
Some utility methods to help parsing when using a DOM parser.
Author:
Thomas Morgner
  • Method Details

    • parseInputStream

      public static Document parseInputStream(InputStream instream) throws ParserConfigurationException, SAXException, IOException
      Parses the given input stream to form a document.
      Parameters:
      instream - the input stream that should be parsed.
      Returns:
      the parsed document or null, when an error occured
      Throws:
      ParserConfigurationException - if the parser could not be initalized.
      SAXException - if the parsing failed due to errors in the xml document
      IOException - if reading from the input stream failed.
    • getText

      public static String getText(Element e)
      extracts all text-elements of a particular element and returns an single string containing the contents of all textelements and all character entity nodes. If a node is not known to the parser, its string value will be delivered as &entityname;.
      Parameters:
      e - the element which is direct parent of all to be extracted textnodes.
      Returns:
      the extracted String