Thanks Gerry and Deepanjan...

I found a solution, but I'm completely puzzled why it worked and the obvious 
E4X statement you both suggested didn't work. I seem to be getting unreliable 
results.  Maybe it's some logic about the statements I am missing.  I don't 
understand why it all can't be done in one statement, I get null for that.

<topic title="abc">
   <keywords>dog,cat,bird</keywords>
   <description>blah blah</description>
   <asset title="Presentation" fileName="giraffe.ppt"/>
   <asset title="Document 1" fileName="a.mpg"/>
   <asset title="Document 2" fileName="b.mpg"/>
</topic>

//doesn't work for me
topic..asset.(hasOwnProperty("@title") && attribute("title") == 
wording)....@filename<mailto:....@filename>

// unreliable. Sometimes it works, sometimes it doesn't.  Is it a bug?  I'm not 
seeing things.  :)
var d:XMLList = thisTopic..*.(hasOwnProperty("@title") && @title == wording);

// doesn't work...why?
var assets:XMLList = topic..asset.(hasOwnProperty("@title") && 
attribute("title") == wording);



-       Michael M.

-

Deepanjan...this solution worked too.
Did you try this:
var topic:XML = topicData[0]; //  gets the below xml, came from an xmllist
var wording:String = "Presentation";
var assets:XMLList = topicData[0]..asset;
trace(assets.(@title == wording));




I have an E4X statement that breaks when I add a filter to it to get a specific 
node.  I keep getting null when I include hasOwnProperty() to the statement.

// I want to get "giraffe.ppt" or <asset title="Presentation" 
fileName="giraffe.ppt"/>
var topic:XML = topicData[0]; //  gets the below xml, came from an xmllist
var wording:String = "Presentation";
// I get an xmllist for this:
var assets:XMLList = topicData[0]..asset;
// but I keep getting null returned for these:
var assets:XMLList = topicData[0]..asset.(hasOwnProperty("@title"));
var assets:XMLList = topic..asset.(hasOwnProperty("@title") && 
attribute("title") == wording)....@filename;

Why does the statement break with the E4X filter?

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to