Hi Tom

> So, should you use <cfxml> to make the xml document that's stored in the
> database available for processing?  I've successfully stored the xml document
> in my database using <cfsavecontent>.  Now, I'm further along in my
> application and need to interact with the xml document.  The examples I've
> seen with <cfxml> show it working by reading the xml document as if it were
> stored in a file (using <cffile>) versus pulling the document from a table.
> I've tried this:
> 
> <cfxml variable="xmlDocument">#qry_GetXML.xmlDocument#</cfxml>
> 
> But I get an error message stating Document root element is missing.  I know
> the xml document has a root element.  I can paste the xml document into an xml
> validator and it checks out.  Any insight would be helpful please.
> 
> I've also tested the document using IsXMLDoc() and it returns No.
> 
> Should the xml document that's stored in the database have the XML
> Declaration, or will <cfxml> tag add the declaration automatically?

You don't need the XML declaration - MX's XML functions only require that
the document be well-formed. But you do need to enclose your variable name
in <cfoutput> tags:

<cfxml variable="xmlDocument">#qry_GetXML.xmlDocument#</cfxml>

will fail, but

<cfxml variable="xmlDocument">
    <cfoutput>#qry_GetXML.xmlDocument#</cfoutput>
</cfxml>

will work.

Alternatively, you could do:

<cfset xmlDocument = xmlparse(qry_GetXML.xmlDocument)>

which is a lot cleaner.

Best wishes

Tom

-----------------+
tom dyson
t: +44 (0)1608 811870
m: +44 (0)7958 752657
http://torchbox.com


-----------------------+
cf-xml mailing list
http://torchbox.com/xml/list.cfm

Reply via email to