A Final General XML Example

[Previous] [Next]

To complete this chapter, we'd like to present a small sample application that's included on the companion CD-ROM that accompanies this book. This demo is a wild mixture of HTML, XML, XSL, and DSO. As a matter of fact, it also includes a Cascading Style Sheet (CSS) to control parts of the presentation. The sample application creates an HTML page—parts of it coming from an XML document, other parts coming from an XSL stylesheet. As in the preceding example, the XSL stylesheet determines which parts of the XML document should be presented and how. The XML document is loaded into an XML DSO, which lets us take advantage of data binding, and we certainly do in this demonstration.

An interesting aspect of this demo is that there's no HTML page on the input side; the only HTML page involved is the one that's dynamically created by the other elements. We're not going to show you any code here; you'll find it on the companion CD-ROM in the \Samples\Hierarchy folder. The only thing we'll show you is the result of opening in Internet Explorer the file that contains the XSL stylesheet. Well, that's not the only thing we'll show you, but as you see in Figure 20-15, it's the first thing.

click to view at full size.

Figure 20-15. An XSL file has been opened in Internet Explorer. The XSL stylesheet has created a DHTML page, using a separate XML document to furnish the page with hierarchical data.

As you can see in Figure 20-15, the HTML page created has two panels. The left panel shows information about the races featured in three race days on two different racetracks. The right panel is still empty, but you can see from the column headers of the panel's table that horses will be listed in it. Figure 20-16 shows that clicking on one of the races renders a list of the horses involved in the selected race.

click to view at full size.

Figure 20-16. As the user selects races in the left panel, the right panel is dynamically refreshed to show the horses involved in the selected race.

When you look at the code on the companion CD-ROM, you'll see that there's practically no code at all involved in filling the table in the right panel. It's filled automatically by use of data binding declared—not programmed—in the HTML TABLE element. You'll also see that the page created is a DHTML page, so when the user selects one race after another, there's no network traffic at all. The data, residing in the XML document, is already in the client. All that happens as the user selects race after race is that the right panel is dynamically refreshed to show a new set of horses.

Quite a few of the XML documents used in this way, dynamic data binding and all, get their content from databases. Getting data from databases and converting it to XML is the main subject of the upcoming chapter, which concludes our XML story, at least for this book.



Designing for scalability with Microsoft Windows DNA
Designing for Scalability with Microsoft Windows DNA (DV-MPS Designing)
ISBN: 0735609683
EAN: 2147483647
Year: 2000
Pages: 133

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