public class XMLUtils extends Object
| Constructor and Description |
|---|
XMLUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Boolean |
AttributeExists(Element node,
String attributeName)
Checks if the provided attribute exists in the supplied node
|
static Document |
Deserialize(File XML) |
static Document |
Deserialize(String XML)
Parses the provided XML string
|
static String |
DoReplaceSpecialCharachters(String XML)
Replaces special characters with xml valid escape sequences.
|
static String |
GetAttribute(Element node,
String attributeName)
Retrieves an attribute's value
|
static String[] |
GetAttributes(Element node,
boolean CollapseNamespase) |
static String |
GetChildCDataText(Node Parent) |
static List<Element> |
GetChildElementsWithName(Node Parent,
String name)
Retrieves all child elements of the provided node that have the provided name
|
static List<Element> |
GetChildElementsWithNameAndNamespace(Node Parent,
String name,
String ns) |
static Element |
GetChildElementWithName(Node Parent,
String name)
Retrieves a single child element of the provided node that has the provided name.
|
static Element |
GetChildElementWithNameAndNamespace(Node Parent,
String name,
String ns) |
static String |
GetChildText(Node Parent)
Retrieves the text payload of the first available Text node that is a member of the provided
node children
|
static String |
GetChildTextOrFirstNonEmptyChildElementAsText(Node Parent) |
static Object |
Query(Document doc,
String query,
QName type) |
static String |
Serialize(Node node) |
static String |
Serialize(Node node,
boolean omitDeclaration) |
static void |
Serialize(String FileName,
String XML) |
static String |
SerializeChild(Element parent) |
static String |
Transform(String Source,
String xslt) |
static String |
UndoReplaceSpecialCharachters(String XML)
Replaces valid xml escape sequences to their original form
|
public static void Serialize(String FileName, String XML) throws Exception
Exceptionpublic static String Serialize(Node node, boolean omitDeclaration) throws Exception
Exceptionpublic static Document Deserialize(String XML) throws Exception
public static Boolean AttributeExists(Element node, String attributeName) throws Exception
node - the Node that should hold the attributeattributeName - the name of the attribute to check forException - The operation could not be performedpublic static String GetAttribute(Element node, String attributeName) throws Exception
node - The node the attribute should exist inattributeName - the name of the attributeException - The attribute does not existpublic static String[] GetAttributes(Element node, boolean CollapseNamespase) throws Exception
Exceptionpublic static String SerializeChild(Element parent) throws Exception
Exceptionpublic static Element GetChildElementWithName(Node Parent, String name) throws Exception
Parent - the node to check its childrenname - the name of the child node to retrieveException - the Operation could not be performedpublic static Element GetChildElementWithNameAndNamespace(Node Parent, String name, String ns) throws Exception
Exceptionpublic static List<Element> GetChildElementsWithName(Node Parent, String name) throws Exception
Parent - the node to check its childrenname - the name of the child node to retrieveException - the Operation could not be performedpublic static List<Element> GetChildElementsWithNameAndNamespace(Node Parent, String name, String ns) throws Exception
Exceptionpublic static String GetChildTextOrFirstNonEmptyChildElementAsText(Node Parent) throws Exception
Exceptionpublic static String GetChildCDataText(Node Parent) throws Exception
Exceptionpublic static String GetChildText(Node Parent) throws Exception
Parent - The node whose child text node's payload should be retrievedException - the Operation could not be performedpublic static Object Query(Document doc, String query, QName type) throws Exception
Exceptionpublic static String Transform(String Source, String xslt) throws Exception
Exceptionpublic static String DoReplaceSpecialCharachters(String XML)
XML - The xml to escapeCopyright © 2018. All Rights Reserved.