XMLUtilJS - Global
-
- UpdatedJan 30, 2025
- 3 minutes to read
- Yokohama
- API reference
The XMLUtilJS script include provides XML utility methods for JavaScript to be used with Discovery scripts.
This script include is provided with the Discovery plugin. Use this script include in any server-side Discovery script in which you need XML utilities.
Access these methods using the static variable XMLUtilJS.
XMLUtilJS - escapeForXMLText(String text)
Provides escape text for a given string.
Name | Type | Description |
---|---|---|
text | String | The text to format. |
Type | Description |
---|---|
String | The formatted text. |
Example
The following example shows how to list escaped XML data in a document. See also stringToValue().
Output:
XMLUtilJS - stringToValue(String str)
Converts a string to an XML value.
Name | Type | Description |
---|---|---|
str | String | The string to convert. |
Type | Description |
---|---|
String | The specified string converted to XML. |
Example
The following example shows how to transform a string of escaped XML to tagged XML output. See also escapeForXMLText().
Output:
XMLUtilJS - unescapeForXMLText(String text)
Provides un-escaped XML for a given string.
Name | Type | Description |
---|---|---|
text | String | The XML text to clean up. |
Type | Description |
---|---|
String | The cleaned up XML string. |
Example
The following example shows how to convert an escaped XML string to tagged XML output. See also escapeForXMLText().
Output:
XMLUtilJS - valueToString(String XMLvalue)
Converts an XML value to a string.
Name | Type | Description |
---|---|---|
XMLvalue | String | The XML to convert |
Type | Description |
---|---|
String | The XML value converted to a string. |
Example
The following example shows how to convert an XML document to a string.
Output: