Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. 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