user587159
user587159

Reputation: 357

Flex XML descendents

i have complex XML structure i want get all descendents uisng some xml paren.child.@attribute representation

For example

<employes>
<employe id="a123">
    <month name="jan" sales="100" target="110">
        <task  sale="100" target="110"/>
    </month>
    <month name="Feb" sales="150" target="150">
        <task  sale="75" target="75"/>
        <task  sale="75" target="75"/>
    </month>
</employe>
<employe id="b123">
    <month name="dec" sales="50" target="100">
        <task  sale="50" target="100"/>
    </month>
    <month name="jan" sales="100" target="110">
        <task  sale="100" target="110"/>
    </month>
    <month name="Feb" sales="150" target="150">
        <task  sale="75" target="75"/>
        <task  sale="75" target="75"/>
    </month>
</employe>

Suppose i want get all xml nodes with month.task.@target how can i implement this, I mean i only give input as "month.task.@target" and the return should be XMLList containing all node that have same structure can any one help me please thanks

Upvotes: 1

Views: 591

Answers (2)

user587159
user587159

Reputation: 357

thank you for replying , I know the XML descendent operator, My problem is like Flex datagrid allows to define datagridcolumn in MXML and setting datafield values as path to the entire XML node. i would need to create a similar component, but it follows coplex representation

like

  1. datafield="month .@name" />

for that my itemrenderer shoud process the each data object and construct the childs as image i have attched

Upvotes: 0

Christophe Herreman
Christophe Herreman

Reputation: 16085

You'll need to use the ".." operator.

Your query should look something like:

employes..task

This will return all "task" nodes on any level.

You can also add filtering on the attributes:

employes..task(@target == 75)

Upvotes: 1

Related Questions