Library sample chapters
Using XML Queries and Transformations
- Introduction
- XPath Query Syntax
- Building a Path
- Selecting Subsets
- Built-In Functions
- IE5 Conformance
- XLST
- XLST Elements
- Pre-defined Templates
- Number Calculation Example
- Commands
- Control of Flow
- Variables and Parameters
- Top Level Settings
- Built-in Functions
- Simplified Syntax
- The IE5 Implementation
- XLST Examples
- Giving Style to XML
- Summary
Introduction
This is a sample chapter from Professional Visual Basic XML
Now we have an easy and platform-independent method of describing XML data, validating its type as we wish and modifying and reading it programmatically. So we basically have a transportable miniature database. No surprise then that when you start to work with it, you'll feel the need for a query mechanism. Using the DOM, you can get to each and every node in your document, but it can get tiresome, maneuvering through the hierarchies of children to find that single node you are interested in.
What we would like to have is an XML version of SQL. We would like to say "Get me all nodes of type X that have descendants of type Y". Many initiatives in this direction have been started up. There were some working groups specifying only a query language, but query mechanisms were also part of the drafts under development for transformation (XSLT) and linking technologies (XPointer). Then the W3C joined efforts with some of the working groups to specify XPath. XPath is a simple syntax to select a subset of the nodes in a document. It now has recommendation status and is used in both the XSLT and XPointer standards (as we'll see later in this chapter and in the next chapter).
Later in this chapter you will understand the importance of XPath in the context of transforming one document type to another, but first we will look at using XPath as a pure querying tool. In the initial release of IE5, a basic version of XPath implementation was included (then called XQL). Once XPath and XSLT gained recommendation status, Microsoft promised to deliver a fully compliant implementation of XPath and XSLT soon, and in January 2000 Microsoft shipped a developers preview of the MSXML library. In the appendices for XPath and XSLT (Appendix C and D respectively), you can find exactly which features are supported in which releases.
We will work with the full version of XPath in this chapter. If you want to program for the MSXML library that came with IE5 originally (if you cannot update to the newer version on all installed versions), you are restricted to a subset of XPath. We will indicate what can be used in the earlier IE5 versions in a separate section.
Be aware of the fact that several (more powerful) XML query languages are still under development. These include a syntax called XQL, that has firm support from IBM, and an initiative from the W3C, called XML Query, which is still in the first stages of specification. At the moment, XPath is the only way that has reached recommendation status and it looks like it will be a long time before anything else will.
This chapter will cover:
- XPath for querying a document
- XSLT for transforming a document
- Styling a document with Cascading Style Sheets
- Styling a document by using transformations (XSLT)
Related articles
Related discussion
-
How to import Xml file into a table in MS-ACCESS database using Visual Basic 6.0?
by sutanu_halder (0 replies)
-
XML transformation: how to save it into a hmtl file.
by srinathnrk (1 replies)
-
VB6, SQL 2005 & DMO
by elajaunie3 (1 replies)
-
sending sms from pc
by sriraj20074 (0 replies)
-
A particular gallery image
by margy80 (0 replies)
Events coming up
-
Jul
13
SmartClient
California, United States
A Smart Client is an application that uses local processing, consumes XML Web Services and can be deployed and updated from a centralized server. While the .NET Framework (Windows Forms) and the .
The table under "format attribute" on the following page also seems to be truncated: http://www.developerfusion.com/show/89/10/
my apologies for that, it appears the article became truncated. The rest of the text on 'giving style to XML' is now there.
Regards,
The 'giving style to XML' part of the article (which is the only part that interested me, sigh) is apparently corrupt - It ends in the middle of a sentence, and so it doesn't explain one bit of what it promises to...
This thread is for discussions of Using XML Queries and Transformations.