All pastes #167300 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-09-11 21:20 UTC
rendered paste body
icapInfo_xml = new XML();
icapInfo_xml.ignoreWhite = true;
icapInfo_xml.load('data.xml');
icapInfo_xml.onLoad = function (success) {
        if (success) {
           trace('data.xml loaded. Contents are: '+this.toString());     
       
		}
};

// create a new XML document
var doc:XML = new XML();

// create a root node
var rootNode:XMLNode = doc.createElement("stats");

// create three child nodes
var numbers:XMLNode = doc.createElement("numbers");

// add the rootNode as the root of the XML document tree
doc.appendChild(rootNode);

// add each of the child nodes as children of rootNode
rootNode.appendChild(numbers);

// create an array and use rootNode to populate it
var firstArray:Array = doc.childNodes;
trace (firstArray); 
// output: <stats><numbers></ numbers></ stats>

// create another array and use the child nodes to populate it
var secondArray:Array = rootNode.childNodes;
trace(secondArray); 
// output: <numbers></ numbers>


txt = 'data.xml loaded. Contents are: '+this.childNodes[0].nodeValue;