好的,这是我的代码:
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
似乎只有在出现超过 1 次时才会找到它。
难道我做错了什么?