Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hi,
is there an easy way to create valid xml code? Or is the only way to work with string operations?
Solved! Go to Solution.
Thingworx uses the E4X to work with XML: Processing XML with E4X - Archive of obsolete content | MDN
So creating an near empty Object like in Chapter: Creating an XML object
var languages = new XML('<languages type="dynamic"><lang>JavaScript</lang><lang>Python</lang></languages>');
or
var languages = <languages type="dynamic">
<lang>JavaScript</lang>
<lang>Python</lang>
</languages>;
And then work with the xml object like you would parse it, but set values to the nodes and attributes
Thingworx uses the E4X to work with XML: Processing XML with E4X - Archive of obsolete content | MDN
So creating an near empty Object like in Chapter: Creating an XML object
var languages = new XML('<languages type="dynamic"><lang>JavaScript</lang><lang>Python</lang></languages>');
or
var languages = <languages type="dynamic">
<lang>JavaScript</lang>
<lang>Python</lang>
</languages>;
And then work with the xml object like you would parse it, but set values to the nodes and attributes