|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionI have searched over the net to find some material about the XML DOM but could not find that, so eventually I decided to write one, which will help the other developers to start working in XML DOM. Believe me, it is very easy, but the problem is where to start it. This article gives you some information about the XML DOM. The is the 1st part of the XML DOM implementation in .NET. It includes The XML DOM is implemented through the xmldoc.LoadXml("" + "<title>Pride And Prejudice</title>" + "");
Note that we have passed the tags in the function parameter instead of the file name. If we want to pass the file name then this function will throw an exception. This method does not validate the XML file with the XML schema or DTD. XmlElement element = xmldoc.CreateElement("title");
In the above line, we made a new object of the element.InnerText = "How to load Xml file with XmlDom";
Now we replace the text with the replace method. root.ReplaceChild(element,root.FirstChild);
In the next menu, we load the XML file with the load method. It reads the XML file stream from the disk. Next we want to create an element in that file but this time we want that we insert that element under the tag. For that we create an element and set its text and then search the tag. XmlNodeList node = xmldoc.GetElementsByTagName("system.web");
Through that we now have the reference of the tag. Now add the new element under that tag through the method That’s all folks. Do log back again to check the next article in series.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||