Is the XML doc coming from you or another source?  If it's a UTF-8 doc with
a byte order marker (BOM) in front of the xml declaration it will fail. I'm
not sure about CFMX7 but I'm assuming it was a bug in xmlparse 6 & 6.1 since
technically a BOM can exist and should still validate. 

Open the xml doc in a hex editor.  If there's a BOM you'll see a ... or EF
BB BF in front of the first declaration. If it's not UTF-8 the BOM will be
different but will still be represented by 3 garbage bytes of data.

The simplest way to overcome it is to just strip away everything before your
root element.  You'll need to kill the declaration in the process since CF
won't see the BOM as whitespace.

Ex. 
<cfset begin = Find("<rss version=""2.0"">",CFHTTP.FileContent)>
<cfscript>
begin = begin -1;
xml = RemoveChars(CFHTTP.FileContent,1,begin);
xml = XMLParse(xml);
</cfscript>
<cfdump var="#xml#">

Maybe this helps.

Emmet

-----Original Message-----
From: Aminova, Elena [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 06, 2005 10:10 AM
To: CF-Talk
Subject: RE: Document root element is missing.

Well, I am using CFMX on the server that throws an error and CF7 on the
one that doesn't throw an error. 
Can that cause this error? Why would it? 

-----Original Message-----
From: Adam Haskell [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 06, 2005 9:59 AM
To: CF-Talk
Subject: Re: Document root element is missing.

you are using MX 7? 

Adam H

On 6/6/05, Elena Aminova <[EMAIL PROTECTED]> wrote:
> I am getting the "Document root element is missing." error when i am
trying to parse an xml file on this line:
> <cfset kitFile =  XmlParse(xmlfile)>
> 
> This problem only occurs on the live server, and NOT on the 
> development server. I have tried debugging and its not the permissions

> issue, because i can read the XML files easily when i give it an exact

> filename and then read it  <cffile action="read" file="#filename#" 
> variable="myxml">
> 
> Yet, when i try to run the script which needs to parse the xmlfile and
extract info from it, i am getting the "Document root element is
missing."
> 
> Any advise would be appreaciated
> Thanks
> 
> 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208681
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to