Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
cfhottie #1
Generate XML from CFC...HELP
Can any of you CF experts help me visualize how a CFC needs to look to generate
XML? Do I need to use CF tags to create the XML within a query and return it
as a string ??
I also need to have a CFC to take an XML file and parse it within the service.
A simple sample would be ideal otherwise I could get by with some hand holding.
TIA
cfhottie Guest
-
generate PDF files with ASP.
Hello, generating PDF files with ASP. i searched in google i found http://www.fpdf.org/ this site which is in PHP. but i want the same thing... -
generate xml file
Hello Everyone, I would like te generate an xml file with coldfusion Would this be the way to go about it?: <cfsavecontent variable = "test">... -
what kind of .txt does CF generate?
Why in the world would a text file that I generate with CF not work when I use it exactly the same and it looks identical to the exact same code... -
How to generate pie slices?
Hello. I am working on an app that needs to dynamically generate models that look like pie slices. Creating a cylinder and specifying the start... -
generate MCs with ActionScript
createEmptyMovieClip('bg', 1); bg.attachMovie('theimg', img, 1); vNum = 100; vInc = 1.02; vIt = 2 do { vName = "m" + vNum;... -
adonis1976 #2
Re: Generate XML from CFC...HELP
this depends on how you are building the xml from the query? how is the result
set going to look like? once you know this, what you can do is to have a
cfsavecontent variable with this xml document... After call the method in your
cfc that will read and parse it.. something like
<cfset readMyXml(myXMLvar)>
in the CFC method itself you can have a required argument of type any. Let me
know if it makes sense.
adonis1976 Guest
-
cfhottie #3
Re: Generate XML from CFC...HELP
What I would like to do is to have a CFC receive an arguement and run a query.
Produce the results of the query in an XML format.
Conversely, I need a CFC to receive an XML file, and execute a query to update
a database table for the XML doc it receives. I am basically starting out with
this and would prefer a straight forward, basic sample.
I am just having trouble getting the whole job started. I feel a bit
intimidated by the web service and XML.
:confused;
cfhottie Guest
-
jim1234 #4
Re: Generate XML from CFC...HELP
It's easy to do. Here's an example:
<cfcomponent output="no" displayname="Books">
<cffunction access="remote" name="getEvaluation" returntype="string">
<cfargument name="Id" type="numeric" required="yes">
<cfquery datasource="your_datasource" name="thisQuery">
select id, name, title
from books
where id = <cfqueryparam type="cf_sql_bigint" value="#id#">
</cfquery>
<cfxml variable="XMLEval">
<books>
<cfoutput query="thisQuery">
<book_detail>
<book_id id="#thisQuery.id#"/>
<name>#thisQuery.name#</namd>
<title>#thisQuery.title#</title>
</book_detail>
</cfoutput>
</books>
</cfxml>
<cfset XMLString = toString(XMLBooks)>
<cfreturn XMLBooks>
</cffunction>
</cfcomponent>
jim1234 Guest
-
lad4bear #5
Re: Generate XML from CFC...HELP
Hi there,
Just a quick additon. Depending on how you create you xml and how picky the
your target xml parser is, you can run into problems with whitespace existing
before your xml declaration. If you run into this problem you can sidestep it
as follows:
#Trim(ToString(insertnameofxmldocumenthere)#
lad4bear Guest
-
developwin #6
Re: Generate XML from CFC...HELP
:)
Many thanks to the awesome guys who responded, especially, jim1234 and lad4bear. It made the approach I need to take quite clear.
developwin Guest



Reply With Quote

