{"id":65662,"date":"2021-07-10T04:10:06","date_gmt":"2021-07-10T08:10:06","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/overview-of-xml-programming-in-dot-net-misc-net\/"},"modified":"2025-05-11T20:20:14","modified_gmt":"2025-05-11T20:20:14","slug":"overview-of-xml-programming-in-dot-net-misc-net","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=65662","title":{"rendered":"Overview of XML programming in Dot Net #Misc .Net"},"content":{"rendered":"<p>Brought from our old-site (a very old short-note): http:\/\/salearningschool.com\/displayArticle.php?table=Articles&amp;articleID=625&amp;title=%3Ch2%3EOverview%20of%20XML%20programming%20in%20Dot%20Net%3C\/h2%3E<\/p>\n<h2>Overview of XML programming in Dot Net<\/h2>\n<h5>XML DOM (Document Object Model)<\/h5>\n<p>\nThree ways to read XML documents in dot net are: XML DOM, SAX, XMLReader.<br \/>\nDOM loads entire XML data into memory for processing, it is both read-write,  I mean you can change XML data and save. DOM uses data-structures to represent the data in the RAM.<\/p>\n<p>\nSAX does not load all XML data in memory rather processes sequentially. SAX is good for just reading large XML file\/data but as it does not store the data in the RAM and does not use any data structure, it can not perform complex operations(search) on the data.\n<\/p>\n<p>\nXmlReader class of the .Net framework can also be used to read and process XML data. It provides read only and forward only access.\n<\/p>\n<h5>How XML DOM works?<\/h5>\n<p>The root node of an XML document is represented by the XmlDocument. XmlDocument is derived from XmlNode class. XmlDocument provides methods such as Load(Load XML data from file), LoadXml(takes XML string as parameter to load), and Save(to save XML data into a file). Also, you can use XmlDocument to traverse through the XML data and process\/print  <\/p>\n<p>Example code:<br \/>\nVb.net<\/p>\n<p>dim xmlDo as New XmlDocument<\/p>\n<p>xmlDoc.load(emp.xml);<\/p>\n<p>\/\/or xmlDoc.loadXml<br \/>\n(&#8220;&#8221;);<\/p>\n<p>Console.WriteLine(xmlDoc.InnerXml.ToString)<\/p>\n<p>xmlDoc.save(&#8220;newDoc.xml&#8221;);<\/p>\n<p>C#<\/p>\n<p>XmlDocument xmlDoc = New XmlDocument(); <\/p>\n<p>xmlDoc.load(emp.xml);<\/p>\n<p>\/\/or xmlDoc.loadXml(&#8220;&#8221;);<\/p>\n<p>Console.WriteLine(xmlDoc.InnerXml.ToString())<\/p>\n<p>xmlDoc.save(&#8220;newDoc.xml&#8221;);<\/p>\n<p>Parsing an XML document<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>C#<\/p>\n<p>count=0;<\/p>\n<p>i=1;<\/p>\n<p>XmlNode node=xmlDoc.ChildNodes[1];<\/p>\n<p>foreach(XmlNode node1 in node.ChildNodes)<\/p>\n<p>{<\/p>\n<p>\tforeach(XmlNode node2 in node1.ChildNodes)<\/p>\n<p>\t{<\/p>\n<p>            Console.WriteLine(xmlDoc.DocumentElement.FirstChild.ChildNodes[count].Name+&#8221;:&#8221;+node2.FirstChild.Value);<br \/>\n\t    count = count + 1;<\/p>\n<p>\t}<\/p>\n<p>\ti=i+1;<\/p>\n<p>\tcount=0;<\/p>\n<p>}<\/p>\n<p>&#8212;<\/p>\n<p>count =0<\/p>\n<p>i=1<\/p>\n<p>dim node1 as XmlNode;<\/p>\n<p>node1 = xmlDoc.ChildNodes(1)<\/p>\n<p>foreach node1 in node1.ChildNodes<\/p>\n<p>dim node2 as XmlNode<\/p>\n<p>foreach node2 in node1.ChildNodes<\/p>\n<p> xmlDoc.DocumentElement.FirstChild.ChildNodes(count).Name<br \/>\n+&#8221;:&#8221;+node2.FirstChild.value<\/p>\n<p>next <\/p>\n<p>i=1+1<\/p>\n<p>count=0<\/p>\n<p>next From: http:\/\/sitestree.com\/?p=3766<br \/> Categories:Misc .Net<br \/>Tags:<br \/> Post Data:2016-07-17 15:01:55<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Brought from our old-site (a very old short-note): http:\/\/salearningschool.com\/displayArticle.php?table=Articles&amp;articleID=625&amp;title=%3Ch2%3EOverview%20of%20XML%20programming%20in%20Dot%20Net%3C\/h2%3E Overview of XML programming in Dot Net XML DOM (Document Object Model) Three ways to read XML documents in dot net are: XML DOM, SAX, XMLReader. DOM loads entire XML data into memory for processing, it is both read-write, I mean you can change XML data &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=65662\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1973,1917],"tags":[],"class_list":["post-65662","post","type-post","status-publish","format-standard","hentry","category-c-misc","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":69380,"url":"http:\/\/bangla.sitestree.com\/?p=69380","url_meta":{"origin":65662,"position":0},"title":"Overview of XML programming in Dot Net #24","author":"Author-Check- Article-or-Video","date":"August 19, 2021","format":false,"excerpt":"Overview of XML programming in Dot Net XML DOM(Document Object Model) Three ways to read XML documents in dot net are: XML DOM, SAX, XMLReader.DOM loads entire XML data into memory for processing, it is both read-write, I mean you can change XML data and save. DOM uses data-structures to\u2026","rel":"","context":"In &quot;C# - Misc&quot;","block_context":{"text":"C# - Misc","link":"http:\/\/bangla.sitestree.com\/?cat=1973"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65654,"url":"http:\/\/bangla.sitestree.com\/?p=65654","url_meta":{"origin":65662,"position":1},"title":"XML Related Classes in .Net #Misc .Net","author":"Author-Check- Article-or-Video","date":"July 10, 2021","format":false,"excerpt":"Brought from our old site (yes, very old short-note): http:\/\/salearningschool.com\/displayArticle.php?table=Articles&articleID=633&title=XML%20Related%20Clasees%20in%20.Net XML in ADO.net VB.NET C#.NET XML is the foundation of .NET. .NET internally represents data as XML and hence can provide inter-operability and interaction among applications written in different platforms and languages [.Net compatible]. XmlReader In .Net you can use\u2026","rel":"","context":"In &quot;C# - Misc&quot;","block_context":{"text":"C# - Misc","link":"http:\/\/bangla.sitestree.com\/?cat=1973"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":69924,"url":"http:\/\/bangla.sitestree.com\/?p=69924","url_meta":{"origin":65662,"position":2},"title":"XML Related Clasees in .Net #18","author":"Author-Check- Article-or-Video","date":"August 22, 2021","format":false,"excerpt":"XML in ADO.net VB.NET C#.NETXML is the foundation of .NET. .NET internally represents data as XML and hence can provide interoperability and interaction among applications written in different platforms and languages[.Net compatible].XmlReader In .Net you can use XML with SqlCommand object. You first create a connection to the sql server\u2026","rel":"","context":"In &quot;C# - Misc&quot;","block_context":{"text":"C# - Misc","link":"http:\/\/bangla.sitestree.com\/?cat=1973"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65664,"url":"http:\/\/bangla.sitestree.com\/?p=65664","url_meta":{"origin":65662,"position":3},"title":"XmlTextReader Overview #Misc .Net","author":"Author-Check- Article-or-Video","date":"July 10, 2021","format":false,"excerpt":"Brought from our old site: http:\/\/salearningschool.com\/displayArticle.php?table=Articles&articleID=626&title=XmlTextReader%20Overview Overview of .Net XmlReader and XmlWriter Object XmlReader Can read XML data both from file or stream. Readonly access. Also, provides information about the XML data. XmlTextReader class is derived from XmlReader. It provides faster access to XML data though it does not support\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7512,"url":"http:\/\/bangla.sitestree.com\/?p=7512","url_meta":{"origin":65662,"position":4},"title":"\u09a1\u099f \u09a8\u09c7\u099f \u098f XML \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 \u098f\u09b0 \u09b8\u0982\u0995\u09cd\u09b7\u09bf\u09aa\u09cd\u09a4 \u09ac\u09bf\u09ac\u09b0\u09a3","author":"Author-Check- Article-or-Video","date":"March 25, 2015","format":false,"excerpt":"\u09a1\u099f \u09a8\u09c7\u099f \u098f XML \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 \u098f\u09b0 \u09b8\u0982\u0995\u09cd\u09b7\u09bf\u09aa\u09cd\u09a4 \u09ac\u09bf\u09ac\u09b0\u09a3 Faruk Hosen \u098f\u0995\u09cd\u09b8\u098f\u09ae\u098f\u09b2 DOM ( \u09a1\u0995\u09c1\u09ae\u09c7\u09a8\u09cd\u099f \u0985\u09ac\u099c\u09c7\u0995\u09cd\u099f \u09ae\u09a1\u09c7\u09b2 ) \u09a1\u099f \u09a8\u09c7\u099f \u098f XML \u09a1\u0995\u09c1\u09ae\u09c7\u09a8\u09cd\u099f \u09aa\u09a1\u09bc\u09a4\u09c7 \u09a4\u09bf\u09a8\u099f\u09bf \u0989\u09aa\u09be\u09af\u09bc \u0986\u099b\u09c7: XML DOM, SAX \u098f\u09ac\u0982 XML Reader. DOM \u09aa\u09cd\u09b0\u0995\u09cd\u09b0\u09bf\u09af\u09bc\u09be\u0995\u09b0\u09a3\u09c7\u09b0 \u099c\u09a8\u09cd\u09af \u09ae\u09c7\u09ae\u09b0\u09bf\u09b0 \u09ae\u09a7\u09cd\u09af\u09c7 \u09b8\u09ae\u09cd\u09aa\u09c2\u09b0\u09cd\u09a3 XML \u09a4\u09a5\u09cd\u09af \u09b2\u09cb\u09a1 \u0995\u09b0\u09c7, \u098f\u099f\u09be \u0989\u09ad\u09af\u09bc \u09aa\u09be\u09a0\u09cd\u09af-\u09b2\u0987\u0996\u09cd\u09af, \u09ae\u09be\u09a8\u09c7 \u0986\u09aa\u09a8\u09bf \u098f\u0995\u09cd\u09b8\u098f\u09ae\u098f\u09b2 \u09a4\u09a5\u09cd\u09af \u09aa\u09b0\u09bf\u09ac\u09b0\u09cd\u09a4\u09a8\u2026","rel":"","context":"In &quot;\u09a1\u099f \u09a8\u09c7\u099f\/.Net&quot;","block_context":{"text":"\u09a1\u099f \u09a8\u09c7\u099f\/.Net","link":"http:\/\/bangla.sitestree.com\/?cat=264"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":69382,"url":"http:\/\/bangla.sitestree.com\/?p=69382","url_meta":{"origin":65662,"position":5},"title":"XmlTextReader Overview #24","author":"Author-Check- Article-or-Video","date":"August 19, 2021","format":false,"excerpt":"Overview of .Net XmlReader and XmlWriter Object XmlReader Can read XML data both from file or stream. Readonly access. Also, provides information about the XML data. XmlTextReader class is derived from XmlReader. It provides faster access to XML data though it does not support validating DTD or XML schema. XmlValidatingReader\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=65662"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65662\/revisions"}],"predecessor-version":[{"id":78154,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65662\/revisions\/78154"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=65662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=65662"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=65662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}