The System.Xml namespace contains all the classes you need to work with XML in .NET. At the most basic level, the XmlDocument class lets you load and save XML documents from disk files or from strings. If you've worked with XML in other systems such as Microsoft's own msxml.dll, you'll recognize XmlDocument as similar to the root object in those systems. An XmlDocument object uses a parser to read the XML document and create a node tree: a hierarchical representation of the elements, attributes, and text in the document. For example, to initiate the parsing process for an XML document, you create an XmlDocument instance and pass the file you want to parse to its Load method:
XmlDocument xml = new XmlDocument(); Xml.Load(physical filename of XML document); Response.Write(xml.InnerXml);
The code fragment loads an XML document and sends the XML string contents to the client.
Was this article helpful?