Inside Activate
Development
XML objects example
1 min
xml objects example this article provides a basic example of using xmlvalue, xmlnode and xmlnodelist objects to manipulate xml //create xmlvalue object, this will store the xml document xmlvalue doc = new xmlvalue(); //load a very basic xml document in to the xmlvalue object doc loadxml("\<root>\<tag>this is my data in tag1\</tag>\<tag>this is my data in the second tag\</tag>\</root>"); //select a single node by path, this example will return the first child tag named “tag” xmlnode node = doc selectsinglenode("tag"); //to loop through all nodes called tag use the xmlnodelist class and the foreach statement xmlnodelist list = doc selectnodes("tag"); foreach(xmlnode n in list) { trace writeline(n innerxml); } trace output this is my data in tag1 this is my data in the second tag notes innerxml data without xml tags, e g “this is my data in tag1” outerxml data with xml tags, e g “\<tag>this is my data in tag1\</tag>”