Link to home
Start Free TrialLog in
Avatar of repzat
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
ASKER CERTIFIED SOLUTION
Avatar of R7AF
R7AF
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of muskad202
muskad202

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.