Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFC not output returned XML

Status
Not open for further replies.

jrottman

Programmer
Jun 17, 2005
47
I am writing a function with in my cfc that I am using to return xml. The test code outisde of my function works perfectly, however when I put the code with in my function the I get this error.

XML Parsing Error: xml declaration not at start of external entity
Location: Line Number 3, Column 1:<?xml version="1.0" encoding="utf-16"?>
^

This is my function code:

<cffunction name="displayDocsListQry" access="remote" returntype="xml" output="false">
<cfargument name="fileNum" required="no" type="string" />
<cfdirectory action="list" recurse="yes" directory="#APPLICATION.storePath##APPLICATION.systemInfo.fld_officeCode#/#arguments.fileNum#" name="ListDir" />
<cfquery name="DirQry" dbtype="query">
select * from ListDir
where Type = 'Dir'
</cfquery>
<cfprocessingdirective suppresswhitespace="Yes">
<cfcontent type="text/xml; charset=utf-16">
<cfxml variable="xmlobject">
<cfoutput>
<fileNum label="L060001">
<cfloop query="DirQry">
<directory label="#DirQry.name#">
<cfquery name="fileQry" dbtype="query">
select * from ListDir
where Type = 'File' and directory = '#APPLICATION.storePath##APPLICATION.systemInfo.fld_officeCode#/#arguments.fileNum#/#DirQry.name#'
</cfquery>
<cfloop query="fileQry">
<document label="#fileQry.name#" />
</cfloop>
</directory>
</cfloop>
</fileNum>
</cfoutput>
</cfxml>
<cfset myvar=toString(xmlobject)>
<cfset mynewvar=replace(myvar, "UTF-8", "utf-16")>
</cfprocessingdirective>
<cfreturn mynewvar />
</cffunction>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top