trace(xml.projects.project.(@name == "EFM Columbus Supply Chain Project").characteristics.characteristic.options.option.(@name == "Other" && @value == "True").toXMLString());
//traces <option name="Other" value="True"/>
//broken down to fit in the screen:
trace(
xml.projects.project.(
@name == "EFM Columbus Supply Chain Project"
).characteristics.characteristic.options.option.(
@name == "Other" && @value == "True"
).toXMLString()
);
ОБНОВЛЕНИЕ: на всякий случай, если вы хотите получить тег проекта вместо тега опции:
var xml:XML =
<EFM>
<projects>
<project name="EFM 1" id="wrong">
<characteristics>
<characteristic name="Types of Data">
<options>
<option name="Benefits Information" value="True"/>
<option name="Supply Chain Event Data" value="False"/>
<option name="Physical Movement Data" value="False"/>
<option name="Other" value="True"/>
</options>
</characteristic>
</characteristics>
</project>
<project name="EFM 1" id="right">
<characteristics>
<characteristic name="Types of Data">
<options>
<option name="Benefits Information" value="True"/>
<option name="Supply Chain Event Data" value="False"/>
<option name="Physical Movement Data" value="False"/>
<option name="Other" value="False"/>
</options>
</characteristic>
</characteristics>
</project>
<project name="EFM 2" id="wrong">
<characteristics>
<characteristic name="Types of Data">
<options>
<option name="Benefits Information" value="True"/>
<option name="Supply Chain Event Data" value="False"/>
<option name="Physical Movement Data" value="False"/>
<option name="Other" value="False"/>
</options>
</characteristic>
</characteristics>
</project>
</projects>
</EFM>;
E4X:
trace(xml.projects.project.(@name == "EFM 1" && characteristics.characteristic.options.option.(@name == "Other").@value == "False").toXMLString());
//broken down to fit in the screen
trace(
xml.projects.project.(
@name == "EFM 1" && characteristics.characteristic.options.option.(
@name == "Other"
).@value == "False"
).toXMLString()
);
Выход:
<project name="EFM 1" id="right">
<characteristics>
<characteristic name="Types of Data">
<options>
<option name="Benefits Information" value="True"/>
<option name="Supply Chain Event Data" value="False"/>
<option name="Physical Movement Data" value="False"/>
<option name="Other" value="False"/>
</options>
</characteristic>
</characteristics>
</project>