Adobe CF XML Issue
While working with an XML document the other day I noticed some "interesting" behavior when trying to access a XML Element that started with an underscore. The XML document is valid, parsed correctly and also displayed correctly when dumping the XML Document out.
This issue only showed itself when trying to access the XML Element using dot notation.
Here is an example xml:
<object classcodename="sp_document" processingtype="1" updateifexists="true">
<identifier>5C626917-25EF-4EDC-94FC-731019D25166</identifier>
<content>
<Produkt>wintergarden</Produkt>
<Modified>2010-02-02 17:53:42</Modified>
<Created>2009-08-06 13:59:05</Created>
<ContentType>Dokument</ContentType>
<_UIVersionString>1.2</_UIVersionString>
<Title>1057919169_f57c98e746</Title>
<BaseName>1057919169_f57c98e746</BaseName>
</content>
</object>
when trying to access the the _UIVersionString element in Adobe Coldfusion an empty string is returned.
<cfset myxml =xmlparse(xmltext)>
<cfdump var="#myxml.object.content._UIVersionString#">
The only apparent way to access the element with the underscore is using xmlSearch with an xPath string as follows:
<cfdump var="#xmlSearch(myxml.object,'//content/_UIVersionString')#">
The problem with this is that xmlSearch returns an array.
Another interesting thing is that Adobe Coldfusion supposedly stores XML internally as structures, so I would assume that accessing a structure key with an underscore would produce the same issue. This is actually not the case which can be seen in the following code snippet:
<cfset mystruct = {product="abc",_UIVersionString="1.2",Title="abcdef"}>
<cfdump var="#mystruct._uiversionstring#">
Bug or Feature?
According to some very basic research XML node names can indeed start with an underscore, structkey names can also start with an underscore, therefore I see no reason why xml node names in Adobe Coldfusion shouldn't function.I will submit this as a bug anyway to see what happens. By the way this "bug" exists in CF8 and 9, I have not tested it in CF7. Railo handles the XML correctly.
Happy Coding...

Subscribe
Subscribe via RSS
Follow me on Twitter
Or, Receive daily updates via email.
Tags
adobe air ajax apple cf community cfml coldfusion examples ext flash flex google javascript jquery max2007 max2008 misc open source programming railo software technology ui
Recent Entries
No recent entries.
Blogroll
An Architect's View
CFSilence
Rey Bango
TalkingTree

http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbu...
<a href="http://www.city32.com/www.auctionzip.com/">... review</a>
http://www.city32.com/www.auctionzip.com/