I'd guess it's a whitespace problem. Is there leading whitespace in your
generated XML? Try adding <cfcontent type="application/xml" reset="yes">
just before your output your xml.

Matthew



  _____  

From: Les Mizzell [mailto:[EMAIL PROTECTED]
Sent: Sunday, 30 May 2004 2:24 p.m.
To: CF-Talk
Subject: CFC "Document Root Element is Missing" Error

Evening,

I'm using a modified CFC originally from the Macromedia site to grab a
RSS News Feed. The .cfc file is in the same folder as the doc calling
the CFC.

It works perfectlly on my local machine. However, when I put it out on
the server, I get a "Document Root Element is Missing" error message.

Anybody got any ideas?  I have access to the CF Admin. on the server in
question.

Thanks

CODE BELOW:

*****On the Page outputting the feed:*****

<cfinvoke component="GetNewsFeed" method="getheadlines"
returnVariable="newsfeed" url=""
type="rss">

<!---Queries and Output Statements on down the page --->

*****GETNEWSFEED.cfc******
<cfcomponent>
   <cffunction name="GetHeadlines" access="public" output="True">

     <cfargument name="url" type="string" required="true"/>
     <cfargument name="type" type="string" required="true"/>

   <cfhttp url="">    <cfscript>
     try {
       switch(trim(lcase(arguments.type))) {
         case 'rdf':
           selectedElements = XmlSearch(xmlparse(cfhttp.filecontent),
"/rdf:RDF/:item");
           break;
         case 'rss':
           selectedElements = XmlSearch(xmlparse(cfhttp.filecontent),
"/rss/channel/item");
           break;
         default:
           return false;
           break;
       }
       articles = QueryNew("title, link, description");
       for(index = 1;index lt ArrayLen(selectedElements);index = index +
1) {
         QueryAddRow(articles);

QuerySetCell(articles,"title",selectedElements[index].title.XmlText);
         QuerySetCell(articles,"link",selectedElements[index].link.XmlText);

QuerySetCell(articles,"description",selectedElements[index].description.XmlT
ext);
       }
     } catch(Any excpt) {
       return excpt.Message;
     }
     </cfscript>

     <cfreturn articles/>

   </cffunction>
</cfcomponent>

--
Les Mizzell
---------------------------------------
Do geeks die when exposed to sunlight?
---------------------------------------

  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to