Package com.peterphi.std.util
Class DOMUtils
java.lang.Object
com.peterphi.std.util.DOMUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentBuilder
Create a new (namespace-aware) DocumentBuilderstatic Document
static Document
parse
(InputStream xml) static Document
static Document
static Document
parse
(InputSource src) static String
Serialise the provided source to a pretty-printed String with the default indent settingsstatic void
pretty
(Source input, StreamResult output) Serialise the provided source to the provided destination, pretty-printing with the default indent settingsstatic String
Serialise the provided Node to a pretty-printed String with the default indent settings
N.B.static String
static void
static void
serialise
(Node n, OutputStream os) static void
static void
serialise
(Node n, StreamResult result) static byte[]
static Node
Trim 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
-