XMLHelper
Helper for XML manipulation.
Functions
1
Functions
1convertFromObjectstatic
Convert a JavaScript object to an XML string.
From:
{
name : 'Task 1',
data : [
{
text : 'foo 1',
ref : 'fooItem 1'
},
{
text : 'foo 2',
ref : 'fooItem 2'
}
]
}
To:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>Task 1</name>
<data>
<element>
<text>foo 1</text>
<ref>fooItem 1</ref>
</element>
<element>
<text>foo 2</text>
<ref>fooItem 2</ref>
</element>
</data>
</root>
| Parameter | Type | Description |
|---|---|---|
obj | Object | Object to convert. |
options | Object | Convert options. |
options.rootName | String | Root name for the XML. |
options.elementName | String | Element name for each node of the XML. |
options.xmlns | String | Add value for xmlns property for the root tag of the XML. |
options.includeHeader | Boolean |
|
options.rootElementForArray | Boolean |
|
Returns: String -
the XML