Class DOMUtilities
java.lang.Object
org.pentaho.reporting.tools.configeditor.util.DOMUtilities
Some utility methods to help parsing when using a DOM parser.
- Author:
- Thomas Morgner
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringextracts all text-elements of a particular element and returns an single string containing the contents of all textelements and all character entity nodes.static DocumentparseInputStream(InputStream instream) Parses the given input stream to form a document.
-
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 documentIOException- if reading from the input stream failed.
-
getText
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
-