Law & Legal & Attorney Wills & trusts

How to Write XML Files to Memory With Asp.Net

    • 1). Click the Windows "Start" button and click "All Programs." Click "Microsoft .NET Framework," and click "Visual Studio." Open the ASP.NET project.

    • 2). Add the XML library to the top of your code file. ASP.NET libraries contain several functions that you use to code for processes such as XML manipulation. Add the following code to the top of your ASP code file:

      using System.Xml;

    • 3). Open the file and load the XML into a "reader." The reader is able to read in the content, but it does not parse the XML into memory. You need the reader to load the XML into the XmlDocument class. Add the following code to open the file into a reader:

      XmlTextReader xmlread = new XmlTextReader("customers.xml");

      xmlread.MoveToContent();

    • 4). Load the XML into a XmlDocument class, which loads the information into memory. The following code parses the XML and loads it into the server's memory:

      XmlDocument xmldoc = new XmlDocument();

      xmldoc.Load(xmlread);



Leave a reply