ok here is my code:
var xml:XML = <xml> <typeA amount1='500' amount2='300' amount3='250' date='2008-02-17'/> <typeA amount1='500' amount2='300' amount3='250' date='2008-02-16'/> <typeA amount1='500' amount2='300' amount3='250' date='2008-02-17'/> <typeB amount1='500' amount2='300' amount3='250' date='2008-02-18'/> <typeB amount1='500' amount2='300' amount3='250' date='2008-02-19'/> <typeC amount1='500' amount2='300' amount3='250' date='2008-02-20'/> <typeC amount1='500' amount2='300' amount3='250' date='2008-02-21'/> <typeC amount1='500' amount2='300' amount3='250' date='2008-02-20'/> </xml>; trace(xml.typeA.(@date == '2008-02-16')); // no results trace(xml.typeA.(@date == '2008-02-17')); // finds both trace(xml.typeC.(@date == '2008-02-20')); // finds both trace(xml.typeC.(@date == '2008-02-21')); // no results
It seems like it is only finding it if there is more then 1 occurance.
Am I doing something wrong?
Actually it finds it but because it’s only one item it traces it as an XML (instead of XMList). The node being empty it will just trace an empty string.
Try this :
When you are debugging XML you’d better use the
toXMLStringmethod.