views:

72

answers:

1

Hi all,

I'm working on a RDF file in my application. I loaded it with the URLLoader and I've imported flash.xml.* class in order to manipulate the content of my RDF file. I need to count certain tags ("Description") in an efficient way. The number of the tags I'm searching for is variable and now I'm using a combination of methods firstChild, lastChild, nextSibling in while cicles in order to take the informations I need from the document. My question is if there's a more direct and general "search method" that helps me avoid that complex and not elegant search that I made. The syntax @Property is used to directly access a Tag's property, right? Do you think that it could be useful for me to solve my problem? Thank you all for the help

David

+1  A: 

Sure. Try this:

// assuming xml is the XML object containing your document
var numberOfDescriptionElements:int = xml..Description.length();

In general, you should check out the details of E4X (ECMAScript for XML), a very handy and consise sub-language of ActionScript to access XML structures.

David Hanak