Home > ColdFusion, Web Application Development > ColdFusion 8 CFC Not Generating Well Formed XML

ColdFusion 8 CFC Not Generating Well Formed XML

I’m relaunching my parish’s web site using ColdFusion 8 and Fusebox 4 for the front end with a Flex 3 admin tool.  My CFCs are doing just fine retrieving content for the front end.  Now I have turned my attention to the flex backend and am having trouble.  I’m using <mx:HTTPService> in a Flex component  to call a .cfm page which make s a call to the CFC then generates XML with the following code:

<?xml version=”1.0″ encoding=”utf-8″?>

<mx:Panel xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” creationComplete=”sectionData.send()”>

<mx:HTTPService id=”sectionData” url=”http://path-to-my-server/act_mainMenuFlex.cfm/>

<mx:DataGrid dataProvider=”{sectionData.lastResult.sections.section}” width=”600” height=”400>

<mx:columns>

<mx:DataGridColumn dataField=”strSection” headerText=”Name/>

<mx:DataGridColumn dataField=”strDescription” headerText=”Description/>

</mx:columns>

</mx:DataGrid>

</mx:Panel>

My .cfm page:


<cfprocessingdirective pageencoding = “utf-8” suppressWhiteSpace = “Yes”>

<cfparam name=“strSection” default=“”/>

<cfparam name=“strDescription” default=“”/>

<cfparam name=“cntParent” default= 0 />

<cfif isDefined(“strDescription”) and isDefined(“strSection”) and strSection NEQ “”>

<cfinvoke component=“#APPLICATION.SectionManager#” method=“createSection” returnvariable=“qCreateSection” strSection=“#strSection#” strDescription=“#strDescription#”/>

</cfif>

<cfinvoke component=“#APPLICATION.SectionManager#” method=“retrieveSections” returnvariable=“qRetrieveSections” cntParent=“#cntParent#”/>

<cfoutput>

<cfxml variable=“sectionXML”>

<sections>

<cfloop query=“qRetrieveSections”>

<section>

<cntSection>#toString(cntSection)#</cntSection>

<strSection>#strSection#</strSection>

<strDescription>#strDescription#</strDescription>

</section>

</cfloop>

</sections>

</cfxml>

</cfoutput>

<cfoutput>#sectionXML#</cfoutput>

</cfprocessingdirective>

Executing the above I received: “Error #1090: XML parser failure: element is malformed.”  I have to be missing something because when I simply <cfdump> the query result set, I see the XML which looks fine.  However, if I execute the .cfm page by itself, I get no errors, but my code contains no XML tags.  Rather it looks like this:

1 Home This is the home page for the St. Martin web site. 2 Ministries This is the section under which ministry pages belong. 7 Ministerio Hispano Nothing 8 Religious Education English relgious education 9 Educacion Religiosa Spanish religious education pages 3 Parish News This is the menu link to the news section. 10 FAQ Frequently asked questions 6 Parish InformationClergy and parish contact information. 4 Mass Schedule Link to the Mass schedule.

Obviously, not XML.  I found the code for my .cfm page on the Flex 3 help pages at Adobe.com.  Any thoughts on what I’m doing wrong?  This seems like such an easy thing to do.  I know I have to be missing something.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: