Title: Message
I think part of the problem here is semantics.  What you think is a 'XML Document' and what MX thinks is an 'XML Document' are two different things:
 
As you are the think of them, An XML document is just some text in a specific format.  So, when you use <cfsavecontent>, you fill a variable with your type of text XML document.
 
However, when you use <cfxml> to encompass the same text, you create MX's type of a XML document, which is an object very much like a structure, not just a string.
 
So, if you are just trying to save XML text into a character field in a database, just use cfcontent to save the xml into a string.
 
If, on the other hand, you want MX's version of a XML document, with all it's bells and whistles (again, PLEASE refer to http://www.macromedia.com/desdev/mx/coldfusion/articles/xmlxslt.pdf) then you'll want to use CFXML.
 
So, using your code as before:
 
<cfxml variable="variables.testXML">
   <RootElement>
    <PersonnelProfile>
     <numStructureID/>
     <numPersonnelID/>
     <FirstName/>
     <LastName/>
     <email/>
     <phone/>
     <department/>
    </PersonnelProfile>
...
   </RootElement>
  </cfxml>
 
Now you have a XML Document called testXML.
 
Here's my SQL INsert:
 
  <cfquery name="qryInsert" datasource="#Request.DSN#">
   SET NOCOUNT ON
   INSERT INTO TABLE_NAME(
    txtName
    ,txtDescription
    ,numAuthorID
    ,txtXML
   )
   VALUES(
    '#trim(Arguments.txtName)#'
    ,'#trim(Arguments.txtDescription)#'
    ,#client.numPersonnelID#
    ,'#variables.testXML.ToString#'
   )
   SELECT @@IDENTITY [NewId]
  </cfquery>
 
Notice the addition of 'ToString' in the code.  This is a function of the  XML Document object created using <cfxml> that returns the 'string' of the XML doc.
 
Does that help?

Reply via email to