Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Day 11.  Using XML in ASP.NET

Today's lesson covered XML access from ASP.NET. Because XML is so tightly integrated with the .NET Framework, it's easy to make the most of XML data from within your ASP.NET pages.

Use the XmlTextReader for simple, fast access to an XML data source. This object provides access to the raw data, which means each element (such as opening and closing tags) is treated individually. The Read method will allow you to loop through the elements.

The XmlTextWriter object is similar to the XmlTextReader, except it's used to write XML documents. It uses a series of Write methods to create each XML element.

The XmlValidatingReader provides validation capabilities. You can use this object to validate an XML source against any type of schema, and to add methods in cases where validation fails.

The XmlDocument and XmlNode objects provide access to XML data with full DOM support. This means the XML file is treated more like a traditional data model, versus a simple text file. You can load data with the XmlDocument.Load method and manipulate the data with the XmlNode object and the functions listed in Table 11.2.

The XML .NET Framework also supports relational XML data with the XmlDataDocument, which is analogous to the DataSet object in ADO.NET. This allows you to build UI support for XML data by using the data binding features of ASP.NET.

Tomorrow you're going to look at file input and output through ASP.NET. Reading from and writing to files on the server can be a great help to ASP.NET, providing additional information that can be used for configuration or data stores.


    Sams Teach Yourself ASP. NET in 21 Days
    Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)
    ISBN: 0672324458
    EAN: 2147483647
    Year: 2003
    Pages: 307
    Authors: Chris Payne © 2008-2017.
    If you may any questions please contact us: