|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
CFC "Document Root Element is Missing" Error
Evening,Les Mizzell 05/29/04 10:28 P I'd guess it's a whitespace problem. Is there leading whitespace in yourMatthew Walker 05/30/04 10:44 P Matthew Walker wrote:Les Mizzell 05/31/04 12:30 A OK I see you're not actually generating the XML. Ignore the comment aboutMatthew Walker 05/31/04 12:42 A > <cfdump var="#cfhttp#">Les Mizzell 05/31/04 12:53 A > Charset [empty string]Les Mizzell 05/31/04 01:04 A Well that's definitely your problem -- the cfhttp isn't working. It might beMatthew Walker 05/31/04 01:01 A 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? --------------------------------------- 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? --------------------------------------- _____ 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? --------------------------------------- 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? --------------------------------------- _____ > <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? --------------------------------------- ----- 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? --------------------------------------- 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? --------------------------------------- _____
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||