"xml" object provides methods to perform XML to object and object to XML transformation.
"stringify" method
Transform object into XML string.
| obj | required | object to transform |
| rootElementName | XML root tag name, default is "root" |
Example
"parse" method
Convert XML string into a object
| xml | required | XML to transform |
Example
"parse" method (not yet supported)
Convert XML string into a object
| xml | required | XML to transform |
| settings | XML conversion settings |
"settings" has following attributes:
| convertTypes | default to "true", should string value be converted to types | |
| ignoreAttributes | default to "true", should tag attributes be ignore | |
| forceValueKey | default to "true", only if ignoreAttributes=false, should we represent all tags as objects, or only tags that have attributes | |
| valueKey |
default to "value", if ignoreAttributes=false then valueKey is the tag value key |
Example