Don't use XPath. You'll lose speed and will have to convert the code to AS3.
parentNode is not E4X. You're mixing legacy support with E4X you want the
parent() method. Here's an excerpt from an example in a book that comes out
in a few weeks.
First, node..node returns an XMLList. So, the first line in the
readXMLData() function returns an XMLList object, or an array of all the
nodes that satisfy your query.
The second line shows the first item in that list, and the third line shows
the parent of that item.
var book:XML;
function createBasicStructure() {
book = <book>
<publisher name="O'Reilly" />
<title>Learning ActionScript 3.0</title>
<subject>ActionScript</subject>
<authors>
<author>
<firstname>Rich</firstname>
<lastname>Shupe</lastname>
</author>
<author>
<firstname>Zevan</firstname>
<lastname>Rosser</lastname>
</author>
</authors>
</book>;
}
function readXMLData() {
trace(book..author);
trace(book..author[0]);
trace(book..author[0].parent());
}
createBasicStructure();
readXMLData();
On 11/15/07 11:51 AM, "Alias" <[EMAIL PROTECTED]> wrote:
> Aha, xml.parentNode should do the trick.
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org