Adobe ColdFusion 8

The XML document object

ColdFusion represents an XML document as an object, called an XML document object, that is much like a standard ColdFusion structure. In fact, most ColdFusion structure functions, such as StructInsert, work with XML document objects. For a full list of ColdFusion functions that work on XML document objects, see Functions for XML object management.

You can look at the overall structure of an XML document in two ways: a basic view and a DOM (Document Object Model)-based node view. The basic view presents all the information in the document, but does not separate the data into as fine-grained units as the node view. ColdFusion can access XML document contents using either view.

A simple XML document

The next sections describe the basic and node views of the following simple XML document. This document is used in many of the examples in this chapter.

<?xml version="1.0" encoding="UTF-8"?>
<employee>
<!-- A list of employees -->
    <name EmpType="Regular">
        <first>Almanzo</first>
        <last>Wilder</last>
    </name>
    <name EmpType="Contract">
        <first>Laura</first>
        <last>Ingalls</last>
    </name>
</employee>