Chapter 6. Reading XML and Generic Data

In This Chapter

Creating an XML file for use in a data application

Transforming an XML file for viewing in a browser

Connecting to XML as a data source

Using the ObjectDataSource control to connect to generic data

In recent years, XML has become a common format for storing and transferring data. As a result, you may well encounter some requirements where your Web site has to process XML data.

ASP.NET has some advanced XML handling features that will make your XML work easier. The idea behind the XML features is that your application treats XML data simply as data — just like the data from a database. Thus you use a data source whose specific job is to handle XML data.

In addition to XML, another data source that ASP.NET provides is a general object data source, which can handle data from any kind of object. In this chapter, I cover these two kinds of data sources.

Reading XML and Generic Data

All the code listings that are used in this book are available for download at www.dummies.com/go/aspnetaiofd.

Putting Together Some XML

In order to use the samples in this chapter, you will need some XML. If you happen to have an old pile of XML lying around the living room, feel free to use it. Otherwise, you can use the sample data I provide here.

Listing 6-1 shows an XML file that contains a list of animals arranged hierarchically by type (mammals, birds, amphibians, reptiles, and fish). ...

Get ASP.NET 2.0 All-In-One Desk Reference For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.