Modifying an XML tree

Hey @raphaelRosin,

here is an example to set the Fieldname which is an _Attribute of the _tag Field within the node xml which is a node of testData. Working with xml and trees is a bit fiddely.

I am loading the XML as tree as object which puts it into a nice structure in a sensetalk variable. You can use the debugger to see the actual structure.

Here are a couple of links:

set myCXML to {{
<testData>
<xml>
<Field FieldName="Ref" FieldValue="10" />
</xml>
</testData>

}}
put myobj -- {testData:[{xml:[{_tag:"Field", FieldName:"nothing", FieldValue:"10"}]}]}

put myCXML as tree as object into myobj

put myobj.testData.xml's FieldName -- before
Set myobj.testData.xml's FieldName to "nothing"
put myobj.testData.xml's FieldName -- after


Let me know in case you have further questions.

Cheers,
Karsten

1 Like