My XML database:
<root>
<car>
<index>1</index>
<brand>Ford</brand>
<year>2006</year>
<price>20000</price>
<mileage>70000</mileage>
</car>
</root>
Can someone show me how can I delete the whole record? (index, brand,year,price,mileage) I know that I should use RemoveChild() but I can't do it.
doc.RemoveChild(doc.SelectSingleNode("//root/car/index[@='1']"));
Thanks in advance guys!
RemoveChildmust be called on the immediate parent of the node to be removed, not on the document object. The node you're trying to remove is not a child of the document object; it is a child of the node<root>.