@ThingworxExtensionApiClass(since={6,6}, canInstantiate=true) public final class XMLUtilities extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
ENABLE_XXE |
Constructor and Description |
---|
XMLUtilities() |
Modifier and Type | Method and Description |
---|---|
static org.w3c.dom.Document |
createDocument() |
static org.w3c.dom.Document |
createDocument(java.lang.String contentStr) |
static javax.xml.parsers.DocumentBuilderFactory |
createDocumentBuilderFactory() |
static org.w3c.dom.Document |
createDocumentFromStream(java.io.InputStream is) |
static org.w3c.dom.Element |
getChildElementByTagName(org.w3c.dom.Element node,
java.lang.String element) |
static java.util.ArrayList<org.w3c.dom.Element> |
getChildElements(org.w3c.dom.Element node) |
static java.util.ArrayList<org.w3c.dom.Element> |
getChildElementsByTagName(org.w3c.dom.Element node,
java.lang.String element) |
static java.lang.String |
getChildElementValueByTagName(org.w3c.dom.Element node,
java.lang.String element) |
static java.lang.String |
getChildElementValueByTagNameWithNull(org.w3c.dom.Element node,
java.lang.String element) |
static org.w3c.dom.Document |
getDocument(java.io.InputStream in) |
static org.w3c.dom.Document |
getDocument(java.io.Reader in) |
static org.w3c.dom.Element |
getElementByTagName(org.w3c.dom.Element node,
java.lang.String element) |
static java.lang.String |
getElementValueByTagName(org.w3c.dom.Element node,
java.lang.String element) |
static java.lang.String |
getNodeValue(org.w3c.dom.Node node)
Will return the String value of the given node. |
static java.lang.String |
getTextContent(org.w3c.dom.Node node) |
static java.lang.String |
outputXMLDoc(org.w3c.dom.Document doc)
Used for XML POST and PUT |
static void |
outputXMLDoc(org.w3c.dom.Document doc,
java.io.OutputStream output) |
static void |
outputXMLDoc(org.w3c.dom.Document doc,
java.io.Writer output) |
static java.lang.String |
outputXMLDocFormatted(org.w3c.dom.Document doc)
|
static java.lang.String |
outputXMLDocFormatted(org.w3c.dom.Document doc,
java.lang.Integer indent)
Deprecated.
indent is no longer supported
|
static void |
outputXMLDocFormatted(org.w3c.dom.Document doc,
java.io.OutputStream output) |
static void |
outputXMLDocFormatted(org.w3c.dom.Document doc,
java.io.OutputStream output,
java.lang.Integer indent)
Deprecated.
indent is no longer supported
|
static void |
outputXMLDocFormatted(org.w3c.dom.Document outdoc,
java.lang.String filepath) |
static void |
outputXMLDocFormatted(org.w3c.dom.Document doc,
java.io.Writer output) |
static void |
setNodeValue(org.w3c.dom.Node nodeTarget,
java.lang.String value) |
@ThingworxExtensionApiMethod(since={6,6}) public static javax.xml.parsers.DocumentBuilderFactory createDocumentBuilderFactory() throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public static org.w3c.dom.Document createDocumentFromStream(java.io.InputStream is) throws java.lang.Exception
java.lang.Exception
- If an error occurs
@ThingworxExtensionApiMethod(since={6,6}) public static org.w3c.dom.Document createDocument()
@ThingworxExtensionApiMethod(since={6,6}) public static org.w3c.dom.Document createDocument(java.lang.String contentStr) throws java.lang.Exception
java.lang.Exception
- If an error occurs
@ThingworxExtensionApiMethod(since={6,6}) public static org.w3c.dom.Document getDocument(java.io.InputStream in) throws java.lang.Exception
java.lang.Exception
- If an error occurs
@ThingworxExtensionApiMethod(since={6,6}) public static org.w3c.dom.Document getDocument(java.io.Reader in) throws java.lang.Exception
java.lang.Exception
- If an error occurs
@ThingworxExtensionApiMethod(since={6,6}) public static void outputXMLDoc(org.w3c.dom.Document doc, java.io.OutputStream output) throws java.lang.Exception
java.lang.Exception
- If an error occurs
@ThingworxExtensionApiMethod(since={6,6}) public static void outputXMLDoc(org.w3c.dom.Document doc, java.io.Writer output) throws java.lang.Exception
java.lang.Exception
- If an error occurs
@ThingworxExtensionApiMethod(since={6,6}) public static java.lang.String outputXMLDoc(org.w3c.dom.Document doc)
@ThingworxExtensionApiMethod(since={8,1}) public static void outputXMLDocFormatted(org.w3c.dom.Document doc, java.io.Writer output) throws java.lang.Exception
java.lang.Exception
- If an error occurs
@ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,1}) @Deprecated public static void outputXMLDocFormatted(org.w3c.dom.Document doc, java.io.OutputStream output, java.lang.Integer indent) throws java.lang.Exception
java.lang.Exception
- If an error occurs
outputXMLDocFormatted(Document, OutputStream)
@ThingworxExtensionApiMethod(since={8,1}) public static void outputXMLDocFormatted(org.w3c.dom.Document doc, java.io.OutputStream output) throws java.lang.Exception
java.lang.Exception
- If an error occurs
outputXMLDocFormatted(Document, Writer)
@ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,1}) public static java.lang.String outputXMLDocFormatted(org.w3c.dom.Document doc, java.lang.Integer indent)
outputXMLDocFormatted(Document)
@ThingworxExtensionApiMethod(since={8,1}) public static java.lang.String outputXMLDocFormatted(org.w3c.dom.Document doc)
outputXMLDocFormatted(Document, Writer)
@ThingworxExtensionApiMethod(since={8,1}) public static void outputXMLDocFormatted(org.w3c.dom.Document outdoc, java.lang.String filepath) throws java.lang.Exception
java.lang.Exception
- If an error occurs
outputXMLDocFormatted(Document, Writer)
@ThingworxExtensionApiMethod(since={6,6}) public static java.lang.String getTextContent(org.w3c.dom.Node node)
@ThingworxExtensionApiMethod(since={6,6}) public static java.lang.String getElementValueByTagName(org.w3c.dom.Element node, java.lang.String element)
@ThingworxExtensionApiMethod(since={6,6}) public static org.w3c.dom.Element getChildElementByTagName(org.w3c.dom.Element node, java.lang.String element)
@ThingworxExtensionApiMethod(since={6,6}) public static java.util.ArrayList<org.w3c.dom.Element> getChildElements(org.w3c.dom.Element node)
@ThingworxExtensionApiMethod(since={6,6}) public static java.util.ArrayList<org.w3c.dom.Element> getChildElementsByTagName(org.w3c.dom.Element node, java.lang.String element)
@ThingworxExtensionApiMethod(since={6,6}) public static java.lang.String getChildElementValueByTagNameWithNull(org.w3c.dom.Element node, java.lang.String element)
@ThingworxExtensionApiMethod(since={6,6}) public static java.lang.String getChildElementValueByTagName(org.w3c.dom.Element node, java.lang.String element)
@ThingworxExtensionApiMethod(since={6,6}) public static org.w3c.dom.Element getElementByTagName(org.w3c.dom.Element node, java.lang.String element)
@ThingworxExtensionApiMethod(since={6,6}) public static java.lang.String getNodeValue(org.w3c.dom.Node node)
Node.ELEMENT_NODE
,
Node.ATTRIBUTE_NODE
, Node.TEXT_NODE
and Node.CDATA_SECTION_NODE
. All other Node types will return an empty
string.
Note: As of 7.2.0, if an Node.ELEMENT_NODE
node has child Node.TEXT_NODE
nodes containing only whitespace
characters (like newlines or tabs) the node will be treated as an empty string. For example, if Node.TEXT_NODE
node only
contains "\n\t\t\t", the value will be "".
node
- The DOM node that you want to retrieve the text value from@ThingworxExtensionApiMethod(since={6,6}) public static void setNodeValue(org.w3c.dom.Node nodeTarget, java.lang.String value)