In this blog you will find ASP.NET 3.5 articles and some code samples. These code samples are created by me and should be working. Thanks for visiting my blog! Happy Dot Netting

Friday, October 24, 2008

XML Handling in ASP.NET 3.5


This is a code sample to get the elements from XML file. This XML file should be stored in website directory as it is mapped. 

      
 Dim reader As New XmlTextReader(Server.MapPath("SystemSettings.xml"))
        reader.Read()
        reader.ReadStartElement("Topelement")
        reader.ReadStartElement("Element1")
        EmailToAddress = reader.ReadString
        reader.ReadEndElement()
        reader.ReadStartElement("Element2")
        SwitchSystemBackInMintues = reader.ReadString
        reader.ReadEndElement()


SystemSettings.xml looks like this


No comments: