Hi, It returns the same string as toString(), see following result
<html> <header> <title>my title</title> <link rel="stylesheet" href="http://development.internet/framework/_resource/style/form.css" type="text/css"> </header> <body> <breadcrumb> <a HREF="/fusionmxnet/">Fusion MX</a><a HREF="/fusionmxnet/system/">System</a> </breadcrumb> </body> </html> Notice the link element.. Once again - the document is valid before calling xmlToString() Its driving me nuts.. Its like it knows it needs to convert to html (while that's not what I want) Taco Fleur > -----Original Message----- > From: Jamie Price [mailto:[EMAIL PROTECTED] > Sent: Friday, 17 December 2004 8:08 AM > To: CF-Talk > Subject: Re: toString() generates invalid xml > > > I don't know if this helps or not, but here's an interal KB > we have on a ToString/XML bug: > > CFMX function toString() outputs null when attempting to > output a XML document created with the <cfxml> tag. > > Example:<cfxml variable="ticker"> <xmlticker> > <cfoutput > <tickeritem><headline> > #XMLFormat(Trim(tempText))# </headline> > <link> #XMLFormat(Trim(tempLink))# > </link></tickeritem> </cfoutput> </xmlticker> </cfxml> > <!--- this will output null when sandbox security is enabled > ---><cfoutput>ToString Result: #ToString(ticker)#</cfoutput> > The preceding toString() function outputs null or an empty string. > > Answer/Solution: > The following solution was found on Macromedia's forums. (see > reference below) > > 1. Copy and paste this CF code into the template where the > toString function is being used. > > <!--- Standardized, JAXP-based version ---> > <!--- (info on JAXP at http://java.sun.com/xml/jaxp/) ---> > <cffunction name="XmlToString" returntype="string"> > <cfargument name="Xml" required="true"> > > <!--- Classes from the standard Java/JAXP APIs ---> > <cfset var stream = CreateObject("java", > "java.io.ByteArrayOutputStream")> > <cfset var transformer = CreateObject("java", > "javax.xml.transform.TransformerFactory").newInstance().newTra > nsformer()> > <cfset var domsource = CreateObject("java", > "javax.xml.transform.dom.DOMSource")> > <cfset var streamresult = CreateObject("java", > "javax.xml.transform.stream.StreamResult")> > > <!--- Initialize class instances ---> > <cfset stream.init()> > <cfset domsource.init(Arguments.Xml.getDocumentElement())> > <cfset streamresult.init(stream)> > > <!--- Perform the actual serialization ---> > <cfset transformer.transform(domsource, streamresult)> > > <!--- Return the result ---> > <cfreturn stream.toString()> > </cffunction> > > 2. replace the toString() function with XmlToString() in the CF Code. > > Reference: > http://webforums.macromedia.com/coldfusion/messageview.cfm?cat id=143&threadid=461867 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187964 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

