Data Sets and XML

Data Sets and XML

In this chapter, we will explore a bit more how to use a data set to generate XML. Because our data is represented in memory as text-based XML, the entire result set can be sent over the Internet to any server. To see how this works, we will write a program that retrieves the records from the Categories table in the Northwind database and places them in a data grid. Figure 11-3 shows how we would expect to see the data in a grid control, which isn't any different from how we'd view data if we were using classic Visual Basic.

Figure 11-3

A view of data in a data grid.

Figure 11-4 shows the XML representation of the same data. As you know, this XML format is how the data is stored in memory. XML is also the format in which the data is passed around from tier to tier—pure text instead of a binary object. This approach is the way e-business can be conducted, by sending XML through the HTTP Port 80 on a Web server. No complicated specialized formats or special value added networks (VANS) are needed to transmit the file. Using XML, the data can be shipped safely to anywhere in the world with no special setups or handshakes agreed upon up front.

Figure 11-4

The data is stored in memory as text-based XML.

Finally, we can examine the schema of the XML file. The XML schema is the self-describing part of a data set, shown in Figure 11-5. With the schema, disparate and heterogeneous systems can know what an XML file contains without ever seeing the structure before. The XML schema (XML schema definition, or XSD) supports data types and the use of XML syntax, is able to be processed by XML processors, and supports global and local scope as in the use of identical element names within nested elements. So the XSD is itself an XML document.

Figure 11-5

A data set describes itself in an XML schema.



Coding Techniques for Microsoft Visual Basic. NET
Coding Techniques for Microsoft Visual Basic .NET
ISBN: 0735612544
EAN: 2147483647
Year: 2002
Pages: 123
Authors: John Connell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net