In the previous chapter we looked at how we can expose data via components in our application's data tier in a range of formats. However, all the examples in the previous chapter accessed a data source that is a relational data store in our case a SQL Server database.
Depending on the features of our application's middle tier, or the type of client we are serving to, we may have to tailor the data format to suit their requirements. What if the data source is not "relational", but (as is increasingly becoming the case) an XML document?
NET objects (such as the Data Reader and Data Set) to extract the data, and returning it in various other formats as well such as an Array and an XML document.
However, there are an increasing number of occasions where the data is supplied in XML format.
In this chapter, we'll continue examining the examples we started looking at in the previous chapter.
As well as a series of pages that use data extracted from a relational database, there is an equivalent set of pages that use data stored as an XML document in a disk file.
It could be a file stored on disk, or a stream of XML delivered by another component, a Web Service, or another service or application such as Biz Talk Server.
The Xml Reader objects have methods that allow us to read nodes from a document in a specific format, or retrieve them as node objects.
However, note that three of the functions in the component require a schema to be provided, and these methods will raise an error if they are called when the optional second parameter to the constructor was not set when the component instance was created.
The three methods are Get Suppliers Validating Reader, Get Suppliers Data Set and Get Suppliers Xml String.
Or, as we've previously discussed, there are useful possibilities for using data as XML where the client is able to process this XML directly, for example using an XML parser located on the client machine. However, in the remainder of this chapter we'll consider how we can take XML data and expose it to the client or the middle tier in a range of different ways.
We demonstrate this in a range of ways in later chapters. NET Framework is installed on the client, we can use the . You can download the samples shown here to run on your own systems.