Basics

<products> is the main node.<product> is a smaller node, found in the main node, each one contains information about a product (its parent is ‘product’)<name> and <price> are nodes which correspond to product node (parent node: ‘product’).

Ok, now for the coding part, include in the project: using System.Xml;
After this, we create an XmlDocument object - used for opening the xml file:

XmlNodeproduct_name=xmldoc.CreateElement("name");product_node.InnerText="Pencil";//set the product's name
product_node.AppendChild(product_name);//and attach it to the product node
XmlNodeproduct_price=xmldoc.CreateElement("price");product_price.InnerText="9$";nod_produs.AppendChild(product_name);

Deleting a node

A node is ‘deleted’ when it’s removed from it’s parent node, so if we want to delete the last node from the list - the one that we created before, we use this:

1
2

XmlNodenode=xmldoc.SelectSingleNode("/products/product[name='Pencil']");//select node where name is 'Pencil'
node.ParentNode.RemoveChild(node);