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...

4 Comments to "Adobe CF XML Issue"- Add Yours
Gary Gilbert's Gravatar Bug 82106 Verified by Adobe ColdFusion Team

http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbu...
# Posted By Gary Gilbert | 2/16/10 2:04 PM
Ben Nadel's Gravatar Hmm, definitely sounds like a bug to me.
# Posted By Ben Nadel | 2/17/10 7:32 PM
henery's Gravatar This post best suits the people related to IT . They can get the info about Adobe CF XML Issue. This is very important issue and must be addressed carefully. Thanks for sharing this info here.
<a href="http://www.city32.com/www.auctionzip.com/">... review</a>
# Posted By henery | 12/27/11 7:35 AM
henery's Gravatar This post best suits the people related to IT . They can get the info about Adobe CF XML Issue. This is very important issue and must be addressed carefully. Thanks for sharing this info here
http://www.city32.com/www.auctionzip.com/
# Posted By henery | 12/27/11 7:36 AM

Powered By Railo

Subscribe

Subscribe via RSS
Follow garyrgilbert on Twitter 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

Wish List

My Amazon.com Wish List