Chris,

How can i get the innertext of an xml node of type 1 (without doing toString and stripping the xml tags) in flash mx (not 2004)?

nodeValue doesn’t work on type 1 apparently… returns null…

Loop through all the child nodes of your node and concatenate the value of the text nodes...

var nodeValue:String = "";

for (var i:Number = 0; i < node.childNodes.length; i++) {
  var child:XMLNode = XMLNode(node.childNodes[i]);
  if (child.nodeType == 3) {
    nodeValue += child.nodeValue;
  }
}

trace(nodeValue);


If your question is how to get the equivalent of innerHTML then change...

  if (child.nodeType == 3) {
    nodeValue += child.nodeValue;
  }

...to...

  nodeValue += child.toString();

Hope this helps!

Steve

--
Steve Webster
Head of Development

Featurecreep Ltd.
http://www.featurecreep.com
14 Orchard Street, Bristol, BS1 5EH
0117 905 5047


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to