Perfect, thanks for the help!


Morten Barklund Shockwaved wrote:

Mike Boutin wrote:

even in this case the result is undefined

string = XPath.selectNodes(my_xml, "/pathto[1]/xml").nodeValue;


I've just gotten the libraries, and it is exactly as I expected. selectNodes returns an Array of XMLNode-objects. Even the notion of /text() is just to get the node, which has no name, as it is a textnode - but it does not mean, that it will return the text. The function will still return an array of XMLNode-objects. So in order to actually get the text, you need to select the corrent index in the array, and then get the nodeValue from the XMLNode. given:

var nodes:Array = XPath.selectNodes(my_xml, "/pathto[1]/xml/text()");
var textnode:XMLNode = XMLNode(nodes[0]);
var text:String = textnode.nodeValue;

That would be the proper way to do this perfectly and correctly. And rather OOP and nice too :)


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to