Qutaibah
08-05-2007, 04:22 PM
Hello all,
I have run into a difficulty xml. I am hopping for some help, any help would be appreciated. here is the situation:
I am trying to filter xml item based on its child elements. for instance:
<items>
<item name="box1">
<content cCode="04">Substanc 04</content>
<weight unit="lb">2000</weight>
<location sCode="02">StG-02</location >
</item>
<item name="box2">
<content cCode="04">Substanc 04</content>
<weight unit="lb">1200</weight>
<location sCode="02">StG-02</location >
</item>
<item name="box3">
<content cCode="24">Substanc 24</content>
<weight unit="lb">1400</weight>
<location sCode="02">StG-02</location >
</item>
<item name="box4">
<content cCode="04">Substanc 04</content>
<weight unit="lb">5000</weight>
<location sCode="02">StG-02</location >
</item>
</items>
a few months ago, Dr_Zeus helped me with a snippet of code that can help filter the xml document. The code provided looks like this:
var myFilter =
[{name: "content", value: "Substanc 04"},
{name: "weight", value: "4000"}];
// LOOP
var filterName = myFilter[i].name;
var filterValue = myFilter[i].value;
var myList = myList.(child(filterName) == filterValue );
with the code as it is, I will only be able to select "substance 04" items whose weight is == to 4000. in this case (the case of the xml document provided above) the are no matches
What I am trying to do, is select all "substance 04" items whose weight is EQUAL or LESS than 4000.
I really to tired hard to resolve this issue but couldn't figure it out. Any help would be appreciated.
I have run into a difficulty xml. I am hopping for some help, any help would be appreciated. here is the situation:
I am trying to filter xml item based on its child elements. for instance:
<items>
<item name="box1">
<content cCode="04">Substanc 04</content>
<weight unit="lb">2000</weight>
<location sCode="02">StG-02</location >
</item>
<item name="box2">
<content cCode="04">Substanc 04</content>
<weight unit="lb">1200</weight>
<location sCode="02">StG-02</location >
</item>
<item name="box3">
<content cCode="24">Substanc 24</content>
<weight unit="lb">1400</weight>
<location sCode="02">StG-02</location >
</item>
<item name="box4">
<content cCode="04">Substanc 04</content>
<weight unit="lb">5000</weight>
<location sCode="02">StG-02</location >
</item>
</items>
a few months ago, Dr_Zeus helped me with a snippet of code that can help filter the xml document. The code provided looks like this:
var myFilter =
[{name: "content", value: "Substanc 04"},
{name: "weight", value: "4000"}];
// LOOP
var filterName = myFilter[i].name;
var filterValue = myFilter[i].value;
var myList = myList.(child(filterName) == filterValue );
with the code as it is, I will only be able to select "substance 04" items whose weight is == to 4000. in this case (the case of the xml document provided above) the are no matches
What I am trying to do, is select all "substance 04" items whose weight is EQUAL or LESS than 4000.
I really to tired hard to resolve this issue but couldn't figure it out. Any help would be appreciated.