View comments | RSS feed

cfxml

Description

Creates a ColdFusion XML document object that contains the markup in the tag body. This tag can include XML and CFML tags. ColdFusion processes the CFML code in the tag body, then assigns the resulting text to an XML document object variable.

Category

Extensibility tags

Syntax

<CFXML 
  variable="xmlVarName" 
  caseSensitive="yes" or "no">

See also

IsXmlDoc, IsXmlElement, IsXmlRoot, XmlChildPos, XmlNew, XmlParse, XmlSearch, XmlTransform

History

New in ColdFusion MX: This tag is new.

Attributes

Attribute Req/Opt Default Description
variable


name of an xml variable
caseSensitive
Optional
no
  • yes: maintains the case of document elements and attributes
  • no

Usage

An XML document object is represented in ColdFusion as a structure.

The following example creates a document object whose root element is MyDoc. The object includes text that displays the value of the ColdFusion variable testVar. The code creates four nested child elements, which are generated by an indexed cfloop tag. The cfdump tag displays the XML document object.

Example

<cfset testVar = True>
<cfxml variable="MyDoc">
  <MyDoc>
    <cfif testVar IS True>
      <cfoutput>The value of testVar is True.</cfoutput>
    <cfelse>
      <cfoutput>The value of testVar is False.</cfoutput>
    </cfif>
    <cfloop index = "LoopCount" from = "1" to = "4">
      <childNode>
        This is Child node <cfoutput>#LoopCount#.</cfoutput>
      </childNode>
    </cfloop>
  </MyDoc>
</cfxml>
<cfdump var=#MyDoc#>

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6

Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.

Comments


webucator said on Jun 27, 2003 at 4:45 PM :
The CaseSensitive attribute could use an example or a more thorough description. I believe the way it works is that if CaseSensitive is set to "no" all tag names are converted to lowercase. If you want to maintain your XML tags in their original case, you must set CaseSensitive to "yes".
webucator said on Jun 28, 2003 at 12:01 PM :
I was wrong about how it works. See http://webforums.macromedia.com/coldfusion/messageview.cfm?catid=3&threadid=644835&highlight_key=y&keyword1=casesensitive.

I think, an example in the doc would be useful.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/Tags-pt321.htm