Home arrow ColdFusion arrow Page 5 - CFXML: Probing XMLDOM in ColdFusion

CFXML: Probing XMLDOM in ColdFusion

This tutorial examines how to access the individual elements of an XML document in ColdFusion, if you have a reference to that document. Two ways to access the individual elements are demonstrated.

Author Info:
By: Jayaram Krishnaswamy
Rating: 5 stars5 stars5 stars5 stars5 stars / 16
April 03, 2006
  1. · CFXML: Probing XMLDOM in ColdFusion
  2. · Create a ColdFusion Object Using the Microsoft.XMLDOM Class
  3. · On accessing a structure
  4. · How do we get to the attributes?
  5. · How do we get at the Comment node?

print this article

CFXML: Probing XMLDOM in ColdFusion - How do we get at the Comment node?
(Page 5 of 5 )

Well most of the document has been sliced and diced, how are we to get to the comment, which also happens to be a node in the XMLDOC? Review the following snippet. The "comment" happens to be a comment to the root element rather than to the document itself. Also note that trying to cfdump a string gets you a string and it is only when you cfdump a structure that you would get the structure of the node, as we have seen in the previous examples.

<cfset mydoc = XmlParse(xmldoc)>
<cfset wchild=#mydoc.XMLComment#>
<cfdump var="#wchild#"><!---returns [empty string]--->
<cfset wnodes=#mydoc.XMLRoot.XMLName#>
<cfdump var="#wnodes#">
<cfset wcomnt=#mydoc.wclass.XMLComment#>

The display in the browser would appear as follows:


This tutorial clearly shows two ways to probe the XMLDOM in ColdFusion. In the first method, it accesses via the object created using Microsoft ActiveX, and in the second the XMLDOC object is probed using its XML File. The syntax of accessing is different and the reader is warned to check which of these are used. In case you are using the second method with XMLDOC via this file reference, please refer to Macromedia's documentation. The detailed example illustrated in this tutorial should help in understanding the documentation.

DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus

- Adobe ColdFusion Just Got More RAD
- How to Access a SQL Anywhere Database with C...
- CFXML: Probing XMLDOM in ColdFusion
- Creating a Web Service with ColdFusion: the ...
- CFAjax: What it is and How to Use it
- Querying SQL 2000 Server from ColdFusion
- Introduction to ColdFusion Markup Language, ...
- Introduction to ColdFusion Markup Language
- Databases and Dreamweaver MX 2004, concluded
- Databases and Dreamweaver MX 2004
- Welcome to Coldfusion MX 6.1, concluded
- Welcome to Coldfusion MX 6.1
- What You Must Know About ColdFusion Flow-Con...
- What You Must Know About Operators in ColdFu...
- Everything You Must Know About ColdFusion Va...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials