简体   繁体   English

Adobe Flex Filter XMLList

[英]Adobe Flex Filter XMLList

Below is an excerpt from my XML file: 以下是我的XML文件的摘录:

 <car>
  <carname>AC</carname>
  <carmodellist>
    <carmodel>Cobra</carmodel>
  </carmodellist>
</car>

How do I query the xmllistcollection and return all of the cars in the carmodellist where carname == 'AC'? 如何查询xmllistcollection并返回carmodellist中carname =='AC'的所有汽车?

I've tried several combinations without luck, I'm thinking it would be something similar to this: 我没有运气就尝试了几种组合,我认为它会与此类似:

var models:XMLListCollection = new XMLListCollection(vehicles.child(@car=='AC').carmodellist.children());

If you have xml like following: 如果您有xml如下:

<cars>
    <car>
        <carname>AC</carname>
        <carmodellist>
            <carmodel>Cobra</carmodel>
            <carmodel>Cobra2</carmodel>
        </carmodellist>
    </car>
    <car>
        <carname>AB</carname>
        <carmodellist>
            <carmodel>Bobra</carmodel>
        </carmodellist>
    </car>
    <car>
        <carname>AD</carname>
        <carmodellist>
            <carmodel>Dobra</carmodel>
        </carmodellist>
    </car>
</cars>

Then: 然后:

vehicles.car.(carname == 'AC').carmodellist.children()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM