Marcus,

Is there a byte order mark in the document?  If so the first two bytes would
be 0xFE and 0xFF (or the reverse).  This is legal but I found that Xerces
does not handle this properly.  I had to delete the byte order mark in my
documents.

I suppose its also possible that the file contents are somehow being
escaped.  I had this problem when I tried writing out an XML String using
XMLWriter.  The XMLWriter escaped all of the '<' amd '>' with entities and I
got a very similar error message.

Good luck,
Mark 

-----Original Message-----
From: marcus [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 25, 2005 8:39 AM
To: dom4j-user@lists.sourceforge.net
Subject: [dom4j-user] Error in prolog?


OS: Windows XP Pro
Java: 5
Dom4J: 1.6.1
==================

I keep getting

org.dom4j.DocumentException: Error on line 1 of document  : Content is 
not allowed in prolog. Nested exception: Content is not allowed in prolog.

I get the same (more or less) using XOM/NUX.

I tried using XPP3Reader as well with the following result:

org.xmlpull.v1.XmlPullParserException: only whitespace content allowed 
before start tag and not \uef (position: START_DOCUMENT seen \uef... @1:1)
         at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1475)
         at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1351)
....

I have tried using
<?xml version="1.0"?>
and
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
and also to skip the prolog altogether.

The file should be UTF-8 (according to UltraEdit and Firefox it is).

I am invoking using this code:
SAXReader saxReader = new SAXReader();
saxReader.addHandler("/epg/genres/genre",
         new CategoryHandler(tvGuide, languageCode));
saxReader.addHandler("/epg/channels/channel",
         new ChannelHandler(tvGuide, channelMap, languageCode));
saxReader.read(content);

content is an InputStream coming from a file (Windows)

I built the code and tested using small files (it worked then) and the 
error occurs now when I tried to feed it with real data (about 5 
megabytes, file generated by someone else).

The file opens fine in IE and Firefox and I've also tried using another 
parser (REXML in Ruby) which also works fine.

Any ideas?

/Marcus




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to