Heres some code for a test case. I don t understand why the first two queries produce a result but the third one doesn t. Any ideas?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onInit();" >
<mx:Script>
<![CDATA[
private function onInit():void{
var someXML:XML =
<libs>
<library libLevel="System">
<type typeName="Established Problem" typeID="2">
<template templateName="asthma" templateAbbr="asthma-fu" templateInsertDate="05/03/2004" templateID="14"/>
<template templateName="gastroesophageal reflux" templateAbbr="GERD" templateInsertDate="05/03/2004" templateID="15"/>
</type>
</library>
</libs>;
trace("library");
trace(someXML.library.(@libLevel == "System"));//works as expected
trace("type");
trace(someXML.library.type.(@typeID == "2"));//works as expected
trace("template");
trace(someXML.library.type.template.(@templateID == "14"));//returns nothing
}
]]>
</mx:Script>
</mx:Application>
What does work is if I add a dummy node below the one that doesn t query right.
var someXML:XML =
<libs>
<library libLevel="System">
<type typeName="Established Problem" typeID="2">
<template templateName="asthma" templateAbbr="asthma-fu" templateInsertDate="05/03/2004" templateID="14">
<blah/>
</template>
<template templateName="gastroesophageal reflux" templateAbbr="GERD" templateInsertDate="05/03/2004" templateID="15">
<blah/>
</template>
</type>
</library>
</libs>;
Why does it only work if there is a node below it?