XMLTools.Parse
Provide an XML string for the script to convert to a JavaScript object. This function accepts the following parameter:
XML text
: A valid XML string. This parameter is required.
Example
"<root>
<vqLq>-1581244121</vqLq>
<dKRpNdep>W]</dKRpNdep>
<Rq1Nm-ey>-633620547</Rq1Nm-ey>
<e3f>
<PdFC1V>W#Z]</PdFC1V>
<hDx>825304515</hDx>
<QYvdNKe>
<f>]}7?[iA"</f>
<Y>-78579452.03592587</Y>
<rSNjZ>*s30</rSNjZ>
<QyJ>#5;$[F</QyJ>
<TTEuUE-g>964892956.7812719</TTEuUE-g>
</QYvdNKe>
<cfEWBe7WM>-1597163543.052671</cfEWBe7WM>
<fETm>2</fETm>
</e3f>
<rl>1258505526</rl>
</root>"
You have the following options to customize how the XMLTools.Parse tool works:
- Set the maximum nesting depth of XML elements. The default value is 10.
- Specify a prefix for JavaScript attribute names in the output. The default prefix is
@
.
Example: An XML element like<root attr="val">...</root>
will be parsed into a JSON object as{ "root": { "@attr": "val", ... } }
. - Specify a key for root elements that contain attributes and text content but no child elements. The default key is
#text
.
Example: An XML element like<root attr="val">2</root>
will be parsed into a JSON object as{ "root": { "@attr": "val", "#text": 2 } }
. - Specify elements that are always parsed as arrays, regardless of their occurrence in the XML.
To configure any of these settings, submit a support request and include this ID in the description: 2P7YOHEQG4WVH.
Example
var dict = XMLTools.Parse(/*XML Text*/ `
<root>
<vqLq>-1581244121</vqLq>
<dKRpNdep>W]</dKRpNdep>
<Rq1Nm-ey>-633620547</Rq1Nm-ey>
<e3f>
<PdFC1V>W#Z]</PdFC1V>
<hDx>825304515</hDx>
<QYvdNKe>
<f>]}7?[iA"</f>
<Y>-78579452.03592587</Y>
<rSNjZ>*s30</rSNjZ>
<QyJ>#5;$[F</QyJ>
<TTEuUE-g>964892956.7812719</TTEuUE-g>
</QYvdNKe>
<cfEWBe7WM>-1597163543.052671</cfEWBe7WM>
<fETm>2</fETm>
</e3f>
<rl>1258505526</rl>
</root>
`);
Updated 13 days ago