Hi Joel, thank so much! I wrote a blog about this: http://hfug.net/?p=1867
The issue is the double quotes( ) and the apostrophe( ) so I used XMLFormat by itself, and also wrapped it in a ![CDATA[ ]] block, but nothing works. The strange part in the cfdump, everything is fine, but when I write the XML file I get errors for special characters. I thought that XMLFormat handled the escaping special characters like "" ' < etc. The tip node looks like this now <tip><![CDATA[#Trim(XMLFormat(getTips.dailytip))#]]></tip> I have converted db data into XML before, but never had this type of issue, I don't know where I am going wrong thanks so much for your help Johnny On Nov 14, 2010, at 4:26 AM, Joel Polsky wrote: > > Hi Johnny, > > It seems all ok to me...When I run the actual XML file in my browser I get > this error. > Could there be an invalid charater in your data? > > > An invalid character was found in text content. Error processing resource ' > http://dl.dropbox.com/u/1775689/feed/tips_feed.x... > > <tip>Based on four studies conducted before 2007, the > American Institute for Cancer Research stated th... > > > > On Sun, Nov 14, 2010 at 5:03 AM, John Barrett <[email protected]> wrote: > >> >> Hi, >> I am having a problem using code(modified from the docs) to create a XML >> file. I use cfdump and everything looks good, but when I open the xml file >> is is corrupt. >> >> <!--- CF Code---> >> >> <cfquery name="getTips" datasource="my_datasource"> >> SELECT >> tipdate,dailytip,consumer_link,consumer_text,research_link,research_text >> FROM dailytips >> ORDER BY tipdate DESC >> </cfquery> >> >> <!--- Create an XML document object containing the data ---> >> <cfxml variable="tipData"> >> <data> >> <cfoutput query="getTips"> >> <dailytips> >> <date>#DateFormat(tipdate, "mmmm d, yyyy")#</date> >> <tip><![CDATA[#dailytip#]]></tip> >> <consumerlink><![CDATA[<a >> href='#consumer_link#'>#consumer_text#</a>]]></consumerlink> >> <researchlink><![CDATA[<a >> href='#research_link#'>#research_text#</a>]]></researchlink> >> </dailytips> >> </cfoutput> >> </data> >> </cfxml> >> >> <!--- dump the resulting XML document object ---> >> <cfdump var=#tipData#> >> <!--- Write the XML to a file ---> >> <cffile action="write" file="mylocal_directory/feed/tips_feed.xml" >> output=#toString(tipData)#> >> >> I added a CDATA blog to the tip node, thisnking that this was the issue, >> but it did not fix this. I am really lost on this. >> >> Image of cfdump: >> http://dl.dropbox.com/u/1775689/feed/cf_dump.png >> image of xml error: >> http://dl.dropbox.com/u/1775689/feed/xml_error.png >> image of xml file: >> http://dl.dropbox.com/u/1775689/feed/xml_file.png >> >> the xml file : >> http://dl.dropbox.com/u/1775689/feed/tips_feed.xml >> >> The issue is on some of the tip nodes(not all of them) it wraps to the next >> line. >> >> My main goal is to create RSS feed from the database, but I am just >> learning RSS now, so I want to create a XL version first. >> >> Thanks so much, >> Johnny >> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5144 Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm
