Copy link to clipboard
Copied
I'm trying to create xml fron a database table.
This is the code to create the xml file:
<cfxml variable="xPageContent">
<PageContent>
<cfoutput query="qStuff">
<page>
<id>#qStuff.PageContentID#</id>
<description>#qStuff.PageContentDesc#</description>
<header>#qStuff.PageContentHeader#</header>
</page>
</cfoutput>
</PageContent>
</cfxml>
If I take out this line <header>#qStuff.PageContentHeader#</header>
it works fine. The header entrys in the database are paragraphs with html code in them here is one of them
<p><a href="3d-floor-plans.html"> 3D floor plans</a><br /> <a href="Interior-Stills.html"> Interior Stills</a><br /> <a href="Exterior-Stills.html"> Exterior Stills</a><br /> <a href="Animation.html"> Animation</a><br /> <a href="Interactive-3D.html"> Interactive 3D</a><br /> </p>
a <cfdump> will output all selected table entries without problem. It's only when try to reated the xml file that I have a problem.
I'm not sure I understand your question. You can use CDATA to pass whatever HTML you want to pass within an XML element value.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/
Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.
Read this before you post:
http://forums.adobe.com/thread/607238
Copy link to clipboard
Copied
I forgot to mention Im using CF8 and getting data from a mssql database running on a windows server.
Copy link to clipboard
Copied
You need to escape any XML metacharacters from your output. When generating XML text nodes, you can either use a CDATA block:
<header><![CDATA[#qStuff.PageContentHeader#]]></header>
or the XmlFormat function:
<header>#XmlFormat(qStuff.PageContentHeader)#</header>
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/
Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.
Read this before you post:
http://forums.adobe.com/thread/607238
Copy link to clipboard
Copied
Thanks that's great but I still have a problem. I need to retain the html code some how. I'm going to be passing it to flash textfield set to html text. Maybe I can't use xml?
Copy link to clipboard
Copied
You can include HTML within XML elements (not attributes) by using CDATA:
<somexml><![CDATA[<html><head><title>this is an HTML page</title></head><body>this is an HTML page</body></html>]]></somexml>
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/
Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.
Read this before you post:
http://forums.adobe.com/thread/607238
Copy link to clipboard
Copied
That's interesting but I to actually pass on the html as it exist in the database.
This was passed on using <cfdump> :
<p><a href="3d-floor-plans.html"> 3D floor plans</a><br /> <a href="Interior-Stills.html"> Interior Stills</a><br /> <a href="Exterior-Stills.html"> Exterior Stills</a><br /> <a href="Animation.html"> Animation</a><br /> <a href="Interactive-3D.html"> Interactive 3D</a><br /> </p>
Copy link to clipboard
Copied
I'm not sure I understand your question. You can use CDATA to pass whatever HTML you want to pass within an XML element value.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/
Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.
Read this before you post:
http://forums.adobe.com/thread/607238
Copy link to clipboard
Copied
I'm sorry I get it now it works perfectly. I have a very thick skull it's probably radition proof but it's very resistant to ideas too.