House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

CFC "Document Root Element is Missing" Error

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Evening,
Les Mizzell
05/29/04 10:28 P
Matthew Walker wrote:
Les Mizzell
05/31/04 12:30 A
> <cfdump var="#cfhttp#">
Les Mizzell
05/31/04 12:53 A
> Charset [empty string]
Les Mizzell
05/31/04 01:04 A
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Les Mizzell
05/29/2004 10:28 PM

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="http://www.bespacific.com/index.xml" 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="#arguments.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.XmlText);        }      } catch(Any excpt) {        return excpt.Message;      }      </cfscript>      <cfreturn articles/>    </cffunction> </cfcomponent> -- Les Mizzell --------------------------------------- Do geeks die when exposed to sunlight? ---------------------------------------

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Matthew Walker
05/30/2004 10:44 PM

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   _____ 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="http://www.bespacific.com/index.xml" 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="#arguments.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? ---------------------------------------   _____  

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Les Mizzell
05/31/2004 12:30 AM

Matthew Walker wrote: > 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. Exactly where does that need to go, plus if that's it why would it work on my local server, but error on another? It isn't some type of mapping problem? The current page is trying to display this and nothing else: <cfif IsQuery(Newsfeed)>      <cfoutput query="newsfeed">        <li><a href="#link#">#trim(title)#</a></li>      </cfoutput> </cfif> Thanks -- Les Mizzell --------------------------------------- Do geeks die when exposed to sunlight? ---------------------------------------

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Matthew Walker
05/31/2004 12:42 AM

OK I see you're not actually generating the XML. Ignore the comment about cfcontent then. Still, it's an XML parsing error that often seems to be caused by whitespace. You could try cfdumping cfhttp immediately after the cfhttp tag: <cfdump var="#cfhttp#">   _____ Sent: Monday, 31 May 2004 4:26 p.m. To: CF-Talk Subject: Re: CFC "Document Root Element is Missing" Error Matthew Walker wrote: > 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. Exactly where does that need to go, plus if that's it why would it work on my local server, but error on another? It isn't some type of mapping problem? The current page is trying to display this and nothing else: <cfif IsQuery(Newsfeed)>      <cfoutput query="newsfeed">        <li><a href="#link#">#trim(title)#</a></li>      </cfoutput> </cfif> Thanks -- Les Mizzell --------------------------------------- Do geeks die when exposed to sunlight? ---------------------------------------   _____  

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Les Mizzell
05/31/2004 12:53 AM

> <cfdump var="#cfhttp#"> The dump looks correct on my local machine.. But, out on the server: struct Charset   [empty string] ErrorDetail   Connect Exception: Connection timed out: connect Filecontent   Connection Failure Header   [undefined struct element] Mimetype   Unable to determine MIME type of file. Responseheader    struct [empty] Statuscode   Connection Failure. Status code unavailable. Text   YES That help any? I'm completely clueless at the moment.... -- Les Mizzell --------------------------------------- Do geeks die when exposed to sunlight? ---------------------------------------

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Les Mizzell
05/31/2004 01:04 AM

----- Excess quoted text cut - see Original Post for more ----- Ya know - although I have access to the server, it's on the other side of a firewall, and the IT guys that set it up along with the company network, are security paranoid (lawyers office). You wouldn't believe the nightmare of hoops I gotta jump through just to access SQL Server that the site is going to be running off of. $10 says this is firewall/security related, and I know almost nothing about Windoz and Firewall security. Looks like a phone call to the IT guys is in order when they show back up on Tuesday... -- Les Mizzell --------------------------------------- Do geeks die when exposed to sunlight? ---------------------------------------

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Matthew Walker
05/31/2004 01:01 AM

Well that's definitely your problem -- the cfhttp isn't working. It might be worth testing out cfhttp on some other URLs. You could also try setting the cfhttp timeout value.   _____ Sent: Monday, 31 May 2004 4:49 p.m. To: CF-Talk Subject: Re: CFC "Document Root Element is Missing" Error > <cfdump var="#cfhttp#"> The dump looks correct on my local machine.. But, out on the server: struct Charset [empty string] ErrorDetail Connect Exception: Connection timed out: connect Filecontent Connection Failure Header [undefined struct element] Mimetype Unable to determine MIME type of file. Responseheader struct [empty] Statuscode Connection Failure. Status code unavailable. Text YES That help any? I'm completely clueless at the moment.... -- Les Mizzell --------------------------------------- Do geeks die when exposed to sunlight? ---------------------------------------   _____  


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference