When we talk about using XML, the first thing that comes to our mind is the XML DOM. We use XML programming API of W3C Document Object Model (DOM). XML programming means either traversing or manipulating data in the XML tree. These are the only things that we normally do with an XML document. In case of XML DOM, we follow the "bottom-up" approach of creating the XML document using XmlDocument
object first and then building the XML elements and attributes. We do programming with elements and attributes. Coming up is an example of creating an XML document using XML DOM, which is the standard way of doing it using ADO.NET 2.0.
The following code creates an XML document Icecreams
to store different varieties of ice-creams as XML elements. Each ice-cream element contains many elements to hold the properties of ice-cream. Each XML element is created separately and then added to the main Icecream
element as children. After adding all the properties as elements...