Searching XML Databases
By Michael Floyd
When teaching XML, I often explain that XSL can be used to perform many of the same functions as the DOM. The basis for this comment is that both the DOM and XSL (or more specifically, the combination of XSLT and XPath), provide mechanisms for walking document trees, creating new elements, attributes, and entities, and letting you modify them in various ways. Thus, a large amount of what you can do in XSL you can do using the DOM, and vice versa.
My students often ask whether they can altogether forgo either XSL or the DOM. While the short answer often is yes, a quiet voice inside my head always says, "use both." There's no reason why your decision to use one should exclude the other. I often combine DOM and XSL to get the most out of their document manipulation and presentation features.
This is particularly true when it comes to databases. When you have XML documents that represent the result sets of database queries, you can combine DOM and XSL techniques to search them, filter the result sets, perform refinements, and present the results.
What Data, Where?
As the old adage goes, what you see is what you get. In the case of database queries, the client application may see XML, HTML, or even raw data. What you get depends both upon the database format and upon how data is processed on the server.
In a low tech solution, the data could be stored on the server in a flat XML file format. If the client is capable of handling XML data, the server simply redirects the client to the file.