0
所以我有一個這樣的XML存儲在一個變量中的Flex AS3Flex的XML E4X檢查屬性附加傷害值==
var xm:XML=<licenses>
<license id="7" name="No known copyright restrictions" url="http://flickr.com/commons/usage/" />
<license id="4" name="Attribution License" url="http://creativecommons.org/licenses/by/2.0/" />
<license id="6" name="Attribution-NoDerivs License" url="http://creativecommons.org/licenses/by-nd/2.0/" />
<license id="3" name="Attribution-NonCommercial-NoDerivs License" url="http://creativecommons.org/licenses/by-nc-nd/2.0/" />
<license id="2" name="Attribution-NonCommercial License" url="http://creativecommons.org/licenses/by-nc/2.0/" />
<license id="1" name="Attribution-NonCommercial-ShareAlike License" url="http://creativecommons.org/licenses/by-nc-sa/2.0/" />
<license id="5" name="Attribution-ShareAlike License" url="http://creativecommons.org/licenses/by-sa/2.0/" />
</licenses>
和Flickr的API返回一個照片,這被解析的許可證並放入一個物體。可以說,特定照片的許可證ID是可訪問的
myPhoto.licenseId;
如何查找哪個許可證屬於給定的licenseId?
我已經試過
var x1:Object=(xm.licenses.license.name.(@id==myPhoto.licenseId.toString()));
var x2:Object=(xm.license.name.(@id==myPhoto.licenseId.toString()));
var x3:Object=(xm.licenses.license.(@id==myPhoto.licenseId.toString()));
但他們都返回一個空XMLList
此外,如果未將toString()
給出了相同的結果。
現在已經停留了幾個小時,每當我想到它就會變得更加沮喪。任何方式我可以解決它?