> I have a query in a CFC that needs the results to be put
> into XML and
> returned to the calling page. Every thing I try gives me
> errors and I
> haven't found any thing on the web that helps. Any
> examples of how to
> do this would be great.

> By the way, I'm new to CFCs and XML so ignorance is most
> likely my problem. :-\

You _probably_ need the xml you return as a string (not a ColdFusion
XML object) to then pass to a webservice on someone else's server. Am
I right?

You can either use <cfxml> which will produce an error if the xml is
invalid and then use toString() to return the text of the xml, or you
can use <cfsavecontent> to generate the packet, which won't produce
any errors if the xml is invalid, but doesn't require you to conver
it.

Here are samples:

<cffunction name="getXML">
  <cfquery ...>...</cfquery>

  <cfxml variable="mypacket">
    <packet>
      <cfouptut query="...">
        <more><nodes /></more>
      </cfoutput>
    </packet>
  </cfxml>

  <cfreturn toString(mypacket)>
</cffunction>

Or

<cffunction name="getXML">
  <cfquery ...>...</cfquery>

  <cfsavecontent variable="mypacket">
    <packet>
      <cfouptut query="...">
        <more><nodes /></more>
      </cfoutput>
    </packet>
  </cfsavecontent>

  <cfreturn mypacket>
</cffunction>


hth, good luck :)


s. isaac dealey   954.522.6080
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206391
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to