cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Create XML

drichter
14-Alexandrite

Create XML

Hi,

is there an easy way to create valid xml code? Or is the only way to work with string operations?

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

1 REPLY 1

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

Top Tags