XML question: How do I search for children without grandchildren

With an XML document:

var xml =

< root >

< name L1 = "First" >

< garbage / >

< / L1 >

< name L1 = "Second" >

< garbage / >

< / L1 >

< / root >

I need a XMLList tags < L1 > without their children, then the output should be:

< name L1 = "First" >

< name L2 = "Second" >

Can someone help me with the syntaxt actionscript to accomplish this XML query? I could not find an example that does not return the children of the < L1 > tags as well.

Thank you

David

Well, if you need exact release, you could use this line:

trace (xml.toXMLString (match) (/<\s*L1.*?>/g) .join ('\n'));

This approach much faster that doing redundant xmlfiltering + removal of garbage, hope this helps

Tags: Flex

Similar Questions

Maybe you are looking for