public final class XMLUtils extends Object
Modifier and Type | Method and Description |
---|---|
static LSInput |
createLSInput()
Creates LSInput from dom implementation.
|
static LSOutput |
createLSOutput()
Creates LSOutput from dom implementation.
|
static LSParser |
createLSParser()
Creates basic parser instance.
|
static LSSerializer |
createLSSerializer()
Creates basic serializer instance.
|
static Node |
findNodeByName(Document doc,
String pathExpression)
Searches for a node within a DOM document with a given node path expression.
|
static String |
getNodesPathName(Node node)
Returns the path expression for a given node.
|
static Charset |
getTargetCharset(Document doc)
Try to find encoding for document node.
|
static void |
initialize(XmlConfigurer xmlConfigurer)
Initializes XML utilities with custom configurer.
|
static Map<String,String> |
lookupNamespaces(Node referenceNode)
Look up namespace attribute declarations in the specified node and
store them in a binding map, where the key is the namespace prefix and the value
is the namespace uri.
|
static Map<String,String> |
lookupNamespaces(String xml)
Look up namespace attribute declarations in the XML fragment and
store them in a binding map, where the key is the namespace prefix and the value
is the namespace uri.
|
static String |
omitXmlDeclaration(String xml)
Removes leading XML declaration from xml if present.
|
static Document |
parseMessagePayload(String messagePayload)
Parse message payload with DOM implementation.
|
static String |
prettyPrint(String xml)
Pretty prints a XML string.
|
static String |
serialize(Document doc)
Serializes a DOM document
|
static void |
stripWhitespaceNodes(Node element)
Removes text nodes that are only containing whitespace characters
inside a DOM tree.
|
public static void initialize(XmlConfigurer xmlConfigurer)
xmlConfigurer
- public static LSParser createLSParser()
public static LSSerializer createLSSerializer()
public static LSInput createLSInput()
public static LSOutput createLSOutput()
public static Node findNodeByName(Document doc, String pathExpression)
doc
- DOM Document to search for a node.pathExpression
- dot separated path expressionpublic static void stripWhitespaceNodes(Node element)
element
- the root node to normalize.public static String getNodesPathName(Node node)
node
- in DOM tree.public static String serialize(Document doc)
doc
- CitrusRuntimeException
public static String prettyPrint(String xml)
xml
- CitrusRuntimeException
public static Map<String,String> lookupNamespaces(Node referenceNode)
referenceNode
- XML node to search for namespace declarations.public static Map<String,String> lookupNamespaces(String xml)
xml
- XML fragment.public static Document parseMessagePayload(String messagePayload)
messagePayload
- CitrusRuntimeException
public static Charset getTargetCharset(Document doc)
doc
- Copyright © 2008–2017 ConSol Software GmbH. All rights reserved.