User Guide

920 Chapter 3: ColdFusion Functions
<name>Standard paint thinner</name>
<quantity>3</quantity>
<unitprice>8.95</unitprice>
</item>
</items>
</order>
The custorder.dtd file is as follows:
<!ELEMENT order (customer, items)>
<!ATTLIST order
id CDATA #REQUIRED>
<!ELEMENT customer EMPTY>
<!ATTLIST customer
firstname CDATA #REQUIRED
lastname CDATA #REQUIRED
accountNum CDATA #REQUIRED>
<!ELEMENT items (item+)>
<!ELEMENT item (name, quantity, unitprice)>
<!ATTLIST item
id CDATA #REQUIRED>
<!ELEMENT name (#PCDATA)>
<!ELEMENT quantity (#PCDATA)>
<!ELEMENT unitprice (#PCDATA)>
The CFML file is as follows. It uses a filename for the XML file and a URL for the DTD. Note
that the XML and URL paths must be absolute.
<cfset
myDoc=XMLParse("C:\CFusionMX7\wwwroot\examples\custorder.xml",
false, "http://localhost:8500/examples/custorder.dtd")>
Dump of myDoc XML document object<br>
<cfdump var="#myDoc#">