Skip to main content
AttaBoy2
Inspiring
October 22, 2010
Answered

The entity "nbsp" was referenced, but not declared.

  • October 22, 2010
  • 2 replies
  • 4442 views

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.

    This topic has been closed for replies.
    Correct answer Dave Watts

    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>


    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

    2 replies

    Community Expert
    October 23, 2010

    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

    Dave Watts, Eidolon LLC
    AttaBoy2
    AttaBoy2Author
    Inspiring
    October 23, 2010

    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?

    Community Expert
    October 23, 2010

    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

    Dave Watts, Eidolon LLC
    AttaBoy2
    AttaBoy2Author
    Inspiring
    October 22, 2010

    I forgot to mention Im using CF8 and getting data from a mssql database running on a windows server.