[xml] Problem removing nodes from a document


I am trying to write some code that will walk through an XML document
and remove any nodes (and their children) with a particular name.
Unfortunately my code is not working as I expected.

I have attached a small example C program and XML document.  My
expectation is that the program would remove the three <extensions>
nodes and their children, in reality the program fails to remove the
<extensions> child of the <sub2> node.

To fix the problem I have tried swapping the order of the if statement
and the recursive call to strip_extensions in the for loop, but with no

I am probably overlooking something really simple, could some one point
it out for me :-)



Attachment: test.c
Description: Text Data

Attachment: test.xml
Description: application/xml

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]