homeservicesportfoliocontactwebsite design tutorials
 

 

 
 

To the index

XML

  • Are there any XML news feeds I can use on my site?
  • Of what use is XML?
  • Beginner

    Are there any XML news feeds I can use on my site?

    Google for some and you'll find loads.

    to question

    Of what use is XML?

    It's often difficult to figure out why XML is relevant, based simply on reading about it. However, it is relevant, and one way or another, it'll be important to you in the future even if it isn't now - although you might not even know about it!

    To explain this a little bit, it's worthwhile to look at the idea of XML, compared to that of HTML. HTML was created solely as a way to display text information that is fetched from a remote server. Within an HTML document, you've got content and formatting all mixed together. XML, on the other hand, has a more general purpose. It can be thought of as a universal encoding for data. So, you might use XML in lots of places that you wouldn't use HTML. As you've noted above, for HTML generation, CF is a great tool that lets us store content separately from formatting, and combine them as necessary at runtime.

    XML is worthwhile as a universal data encoding syntax because of the simple ubiquity of XML parsers. Parsing is one of the most annoying, error-prone tasks commonly performed in business applications. The less parsing you have to do, the better. The meaning of the encoded data, stored in a DTD or Schema, is completely separate from the information required for parsing.

    Now, it seems to me that, for a lot of the commonly mentioned uses of XML, that if you're already using something like ColdFusion to generate output, XML doesn't necessarily make a lot of sense. However, there are lots of other uses of XML which work well with CF.

    The best example that I can think of is content syndication. WDDX is often used for this (and WDDX is a pretty good example of XML augmenting CF). You might write a script on one server to publish data in WDDX format - or within any other XML language's format - and other servers may retrieve that data. Maybe those other servers aren't even running CF (as hard to believe as that may be *). The beauty of using XML for this is that no one will have to write any parsing code.

    Other potentially interesting uses of XML within CF applications include Simple Object Access Protocol (SOAP) and XHTML, when that comes out - one of the ideas of XHTML is that multiple devices receiving the same XHTML file would display the contents in an appropriate way for each individual device. In the same vein, you might use XML and XSL to move the processing of formatting directives to the client, requiring less work on the server - and you might generate the XML file itself with CF. Or, you might retrieve XML data with CF from a remote server, and use XSL Transformation on the server to format it appropriately before sending it to the client.

    to question