Skip to main content
June 5, 2010
Question

Rendering XML Bug?

  • June 5, 2010
  • 3 replies
  • 562 views

This is the most strange issue...

I'm generating XML and returning it to the page for output. I've got 4 pages that do the exact same thing with the exact same code... variables are the only things that change.

For 3 of the pages, the XML data render in the browser and looks wonderful in View Source.

For 1 elusive page, the XML data does not render in the browser, but the XML is clearly there in View Source.

I'm beginning to reason that this is cause some phantom issue that I can't seem to solve, and it isn't making any sense whatsoever!

Anyone have something similar happen to them or know of a solution?

    This topic has been closed for replies.

    3 replies

    Inspiring
    June 6, 2010

    Phantom issues?  Like null values or empty strings in your data?

    Inspiring
    June 6, 2010

    Have you got some sample code that demonstrates this?

    UPDATED: yes you have.  Dunno why the the two posts above did not show up for me when I initially responded... they displayed AFTER I submitted my comment, sorry...

    --

    Adam

    Message was edited by: Adam Cameron.

    ilssac
    Inspiring
    June 6, 2010

    Not that was not caused by some flaw in the CODE or the DATA that I was working with.

    If you had provided us some idea of the code or data you where working with, we might be able to help;

    But as you didn't.  All I can answer is.

    NOPE.

    June 6, 2010

    This is the function that creates the XML:

    <cfscript>                // TODO move the below function from user to library                var qAssets      = session.user.getLibraryAssets( libraryId=arguments.libraryId, filterByType=arguments.filterByType );                var assets           = xmlNew();           </cfscript>           <!--- TODO: use xml functions to do this --->           <cfsavecontent variable="assets">                <cfoutput><assets></cfoutput>                                <cfif qAssets.recordCount gt 0>                     <cfoutput query="qAssets">                          <#lCase(qAssets.assetTypeName)#>                               <id>#qAssets.id#</id>                               <name>#xmlFormat(qAssets.name)#</name>                               <data>#xmlFormat(qAssets.data)#</data>                               <isAdmin>#iif( isDefined("qAssets.isAdmin") and qAssets.isAdmin eq 1, de(1), de(0) )#</isAdmin>                          </#lCase(qAssets.assetTypeName)#>                     </cfoutput>                     </cfif>                                <cfoutput></assets></cfoutput>           </cfsavecontent>                      <cfreturn assets>

    This is the page the XML is finally rendered in:

    <cfsetting enablecfoutputonly="true"> <!--- 0 = all libraries ---> <cfset variables.xmlAssets = application.library.getAssetXml( libraryId=0, filterByType=application.assetType.VIDEO )> <cfoutput>#xmlParse(xmlAssets)#</cfoutput>

    Inspiring
    June 6, 2010

    You need to refactor this down a bit to test the differences between a sample that works and a sample that doesn't.

    What's an example of a version that works and a version that doesn't (just output the string, don't worry about the xmlParse() bit.

    Is there a reason you're using <cfsavecontent> rather than <cfxml>?

    --

    Adam