Thread: When to use xml
View Single Post
Old Oct 14th, 2005, 7:58 PM   #8
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
When given a more or less compliant set of XML classes (such as with .Net) that support namespaces, XSLT, and Xpath, it's easier to use XML than not. For example, using .Net, I retrieved the forum's RSS feed and extracted the most recent post using just a few lines of code.

However, as noted, XML isn't as suited to replace a database as it is to transfer information. Consider RSS. It can be generated on the fly by a script for the news site/forum/blog/etc, be read by any XML reader (even if it doesn't understand it), be verified against the RSS schema, transformed into something else such as HTML using XSLT, or perhaps displayed in an aggregator. Those are some huge advantages.

Your example of saving rapidly changing data in xml is flawed as Ooble stated. However, consider the possibility of, instead of having your script return an HTML document, construct an XML document on the fly from a database backend. You have the best of both worlds. But what's the big deal with sending an XML document to the client? You are sending the data and only the data. Attach an XSL stylesheet and the client can a) interpret your data how it wants, since for example you may want a desktop app in the future, or b) use the stylesheet to convert the data into the presentation (HTML in this case, though PDF can be useful). Imagine also the savings in bandwidth if only the contents of the page are sent for each request, and the presentation aspect only once (Caching the stylesheet).
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote