SMR,

There are a couple of minor issues with your code, but nothing that
explains why you would get no error message or output.

1.  xsi.  As the previous poster said, you have an extra space between
xsi: and noNamespaceSchemaLocation which cases an error for me on the
XmlParse function.

2.  XSI Namespace.  Namespaces are not locations but rather identify the
owner of elements.  They can point to a schema location, but it is not
necessary.  The namespace for xsi must be
"http://www.w3.org/2001/XMLSchema-instance";.

3.  Schema.  While it would cause no problems whatsoever in creating the
document, the XML does not match the schema you provided.  The schema
shows a root element of document, whereas the cfm code generated xml
code that had a doc-list root element with document elements inside it.

4.  It is not necessary, but when creating an XML file you can try using
the CFXML tag instead of CFSAVECONTENT/XmlParse.  Note that when using
CFXML you do not include the ?XML? declaration.

The following code is a modification of your original and works fine.

HTH,

Sam


<cfscript>
        getdoc=StructNew();
        getdoc.doc_file_name="File1.doc";
        getdoc.doc_filesize=1024;
        getdoc.doc_description="Some word document";
</cfscript>


<cfsavecontent variable="tempxml"><?xml version="1.0" encoding="UTF-8"?>

<cfoutput>
<document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="C:\CfusionMX\wwwroot\doc.xsd">
        
<doc_file_name>#Trim(XMLFormat(getdoc.doc_file_name))#</doc_file_name>
        
<doc_description>#Trim(XMLFormat(getdoc.doc_description))#</doc_descript
ion>
        
<doc_filesize>#Trim(XMLFormat(getdoc.doc_filesize))#</doc_filesize>
</document>
</cfoutput>
</cfsavecontent>
Save content done...

<cfset myXMLDocument=XmlParse(tempxml)>
This is my xml document
<cfdump var="#myXMLDocument#">

<cffile action="write" file="#ExpandPath(".")#/document.xml"
output="#ToString(tempxml)#">

Date: Mon, 4 Nov 2002 11:11:12 -0500
From: "SMR" <[EMAIL PROTECTED]>
Subject: CFXML newbie needs help
Message-ID: <020e01c2841c$cbbfa380$8958e58c@SRALEY>

Just trying to do a simple CFXML output....
(snip)


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to