Package com.peterphi.std.util
Class DOMUtils
java.lang.Object
com.peterphi.std.util.DOMUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentBuilderCreate a new (namespace-aware) DocumentBuilderstatic Documentstatic Documentparse(InputStream xml) static Documentstatic Documentstatic Documentparse(InputSource src) static StringSerialise the provided source to a pretty-printed String with the default indent settingsstatic voidpretty(Source input, StreamResult output) Serialise the provided source to the provided destination, pretty-printing with the default indent settingsstatic StringSerialise the provided Node to a pretty-printed String with the default indent settings
N.B.static Stringstatic voidstatic voidserialise(Node n, OutputStream os) static voidstatic voidserialise(Node n, StreamResult result) static byte[]static NodeTrim all TEXT Nodes under the provided Element
-
Method Details
-
createDocumentBuilder
Create a new (namespace-aware) DocumentBuilder- Returns:
-
parse
-
parse
-
parse
-
parse
-
parse
-
serialise
-
serialiseBytes
-
serialise
-
serialise
-
serialise
-
serialise
-
pretty
Serialise the provided Node to a pretty-printed String with the default indent settings
N.B. this method also trims any leading/trailing whitespace from TEXT nodes- Parameters:
source- the input Node- Returns:
-
pretty
Serialise the provided source to a pretty-printed String with the default indent settings- Parameters:
source- the input Source
-
trim
Trim all TEXT Nodes under the provided Element- Parameters:
e-- Returns:
-
pretty
Serialise the provided source to the provided destination, pretty-printing with the default indent settings- Parameters:
input- the sourceoutput- the destination
-