repzat
asked on
delete a node
Hi, I have an xml doc with this structure:
<FLUSSO>
<INTERNAL_DATA source="WEB"/>
<CURRICULUM>
<ANAGRAPHIC name="David"/>
</CURRICULUM>
<CURRICULUM>
<ANAGRAPHIC name="Stephan"/>
</CURRICULUM>
</FLUSSO>
I need to check the value of the attribute 'name' inside the node <ANAGRAPHIC>. If the value is blank I need to delete the related <CURRICULUM> node.
Thanks and regards
<FLUSSO>
<INTERNAL_DATA source="WEB"/>
<CURRICULUM>
<ANAGRAPHIC name="David"/>
</CURRICULUM>
<CURRICULUM>
<ANAGRAPHIC name="Stephan"/>
</CURRICULUM>
</FLUSSO>
I need to check the value of the attribute 'name' inside the node <ANAGRAPHIC>. If the value is blank I need to delete the related <CURRICULUM> node.
Thanks and regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use the XmlDocument class to load the xml into a DOM in memory. Then, iteratively go through all the nodes. For each node, you can access the attributes using the Attributes property. You can remove a node using the RemoveChild function. Finally, you can save the XmlDocument using the Save function.