Working with XML

As I mentioned in the introduction, ColdFusion MX makes working with XML easy. With ColdFusion MX, you can easily do things such as generate your own XML, parse existing XML using native ColdFusion functions, search through XML using XPath, and transform XML using XSLT and XSL.

Because this chapter does not cover XML itself in any great detail, I recommend reading up on the topic if you aren’t already familiar with it. Two excellent resources to consider are O’Reilly’s http://xml.com web site and the O’Reilly book Learning XML by Erik T. Ray.

A 30-Second XML Primer

The basics of XML are simple to learn. Because you’ll need a basic understanding of XML for the rest of this chapter to make any sense, I’m including what I call a 30-second XML primer to get you started. It doesn’t teach you everything, but it should set you well on your way.

In its most basic form, XML is simply a tag-based markup language for describing data. Both HTML and XML are subsets of SGML (Standard Generalized Markup Language). Although similar in appearance to HTML, XML differs in that it doesn’t have anything to do with how the data it describes is displayed. HTML, on the other hand, is designed to specify how data should be displayed in a hierarchical manner. Another difference between XML and HTML is that XML is extensible. In HTML, you are limited to using the tags that are officially part of the HTML specification (or are supported as browser extensions). In XML, you can create any ...

Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.