Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AS3 Delete child node from XML by child value

I've got an XML with a structure like the following;

 <items>
    <item>5</item>
    <item>3006</item>
    <item>25</item>
    <item>458</item>
    <item>15</item>
    <item>78</item>
 </items>

How do I delete the item with the value 458. Just to clarify this, I don't know the index of that item, so simply calling delete items[index] won't do here. I have to delete by value.

Any hints?

like image 209
AlBirdie Avatar asked Mar 13 '12 10:03

AlBirdie


1 Answers

this should solve it. Btw this will delete all direct chilren with name "item" that have value 458.

delete xml.(item == "458");

To delete recursively all children and subchildren that have name "item" and value 458 use:

delete xml..(item == "458");
like image 115
Adrian Pirvulescu Avatar answered Sep 21 '22 22:09

Adrian Pirvulescu