Class zwt.xml.Utils
A utility class with some useful methods for XML processing.
Defined in: Utils.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
zwt.xml.Utils.jsonToXML(Object_json, String_rootQName, String_namespaceURL)
Translate the specified JSON object into its XML representation.
|
<static> |
zwt.xml.Utils.loadXML(String_url)
Synchronously load the XML file at the specified URL.
|
<static> |
zwt.xml.Utils.loadXMLAsync(String_url, Function_callback)
Asynchronously load the XML file at the specified URL and call the specified callback function with the loaded document as input.
|
<static> |
zwt.xml.Utils.newDocument(String_rootQName, String_namespaceURL)
Create a new XML Document.
|
<static> |
zwt.xml.Utils.stringToXML(String_xml)
Return the XML document object corresponding to the specified XML string.
|
<static> |
zwt.xml.Utils.xmlToJSON(Document_xml)
Translate the specified XML object into its JSON representation.
|
<static> |
zwt.xml.Utils.xmlToString(Document_xml)
Serialize the specified XML object.
|
Method Detail
<static>
zwt.xml.Utils.jsonToXML(Object_json, String_rootQName, String_namespaceURL)
Translate the specified JSON object into its XML representation.
Please note that this method doesn't check for reference cycles in the input JSON object.
- Parameters:
- {Object} Object_json
- The JSON object to translate
- {String} String_rootQName
- The qualified name of the root node in the resulting document
- {String} String_namespaceURL
- The XML namespace to use in the resulting document
<static>
{Document}
zwt.xml.Utils.loadXML(String_url)
Synchronously load the XML file at the specified URL.
- Parameters:
- {String} String_url
- the URL of the XML file to load
- Returns:
- A new XML document containing the XML at the specified URL
<static>
{Document}
zwt.xml.Utils.loadXMLAsync(String_url, Function_callback)
Asynchronously load the XML file at the specified URL and call the specified callback function with the loaded document as input.
- Parameters:
- {String} String_url
- the URL of the XML file to load
- {Function} Function_callback
- The callback function to call
- Returns:
- A new XML document containing the XML at the specified URL
<static>
{Document}
zwt.xml.Utils.newDocument(String_rootQName, String_namespaceURL)
Create a new XML Document.
- Parameters:
- {String} String_rootQName
- The qualified name of the root node. If not specified an empty document is returned.
- {String} String_namespaceURL
- The XML namespace of the document to create. If not specified, no XML namespace is specified.
- Returns:
- A new XML document
<static>
{Document}
zwt.xml.Utils.stringToXML(String_xml)
Return the XML document object corresponding to the specified XML string.
- Parameters:
- {String} String_xml
- The XML string to use to create the XML document
- Returns:
- An XML document
<static>
{Object}
zwt.xml.Utils.xmlToJSON(Document_xml)
Translate the specified XML object into its JSON representation.
- Parameters:
- {Document} Document_xml
- The XML document or XML node to translate.
- Returns:
- A JSON object
<static>
{String}
zwt.xml.Utils.xmlToString(Document_xml)
Serialize the specified XML object.
- Parameters:
- {Document} Document_xml
- The XML document or XML node to serialize.
- Returns:
- The string representation of the specified XML object