• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfxml rearranges elements?

Guest
Nov 25, 2006 Nov 25, 2006

Copy link to clipboard

Copied

<cfxml variable="xmlObject" casesensitive="yes">
<gallery>
<album title="Product Detail">
<cfoutput query="rsImageFiles">
<img src = " http://www.testing.com/Images/Products/#rsImageFiles.Name#" caption = "Flat View" />
</cfoutput>
</album>
</gallery>
</cfxml>

creates this xml file:

<?xml version="1.0" encoding="UTF-8"?>
<gallery>
<album title="Product Detail">
<img caption="Flat View" src=" http://www.testing.com/Images/Products/B1004Back.jpg"/>
<img caption="Flat View" src=" http://www.testing.com/Images/Products/B1004Full.jpg"/>
<img caption="Flat View" src=" http://www.testing.com/Images/Products/B1004Main.jpg"/>
<img caption="Flat View" src=" http://www.testing.com/Images/Products/B1004Thumb.jpg"/>
</album>
</gallery>

The elements 'src' and 'caption' have been rearranged. Any way to avoid this?
TOPICS
Advanced techniques

Views

486

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 26, 2006 Nov 26, 2006

Copy link to clipboard

Copied

I can confirm I see this too. I tried to get around it by using
<cfsavecontent> instead, but as soon as I xmlParse() it, the attibutes are
swapping. It seems they're being ordered alphabetically. Stupid thing for
CF to be doing.

Pls note that relying on the ordering of the attributes conflicts with the
spec of XML: attributes have no sense of ordering (same as struct keys have
no sense of ordering).

Not sure how to get around it though, I'm afraid. I've raised it as a bug,
because whilst there should be no sense of order, I don't think CF should
be going out of its way to CHANGE the ordering. It should certainly not be
SORTING them.

PS: Adobe's bug reporting is a black hole: no reference number is returned
after submission, so there's no way for anyone to track the issue once
submitted. Or even any way of knowing they actually pay any attention to
the issues at all.

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 26, 2006 Nov 26, 2006

Copy link to clipboard

Copied

Unfortunately the sequence of the elements is crucial for the component I am creating this for: SlideShowPro ( http://www.slideshowpro.net/product_ssp.php).

They do not recognize the 'caption' element unless its after the 'src' element.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 26, 2006 Nov 26, 2006

Copy link to clipboard

Copied

> Unfortunately the sequence of the elements is crucial for the component I am
> creating this for: SlideShowPro ( http://www.slideshowpro.net/product_ssp.php).
>
> They do not recognize the 'caption' element unless its after the 'src' element.

I'd drop them a line and point this situation out to them, then. They are
misusing XML.

Having said that, how are you passing the XML to this thing? XML is just a
string... you don't need to use CF's XML functions to build the XML.
<cfsavecontent> does not mung the XML; it's only when one runs it through
xmlPrae() that CF buggers about with it. But there's probably no need to
XML parse it: an external system will expect a string, not a CF-XML-object.

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 26, 2006 Nov 26, 2006

Copy link to clipboard

Copied

LATEST
Good point. I could just create a text file. Looks like thats what I'll have to do.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 26, 2006 Nov 26, 2006

Copy link to clipboard

Copied

Any possibility you could log a bug report with SlideShowPro? Seems like their product shouldn't throw an error in a case like this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation