[jdom-interest] BOM-Handling depends on JRE?!

Michael Kay mike at saxonica.com
Thu Mar 17 03:48:43 PST 2005


> this code throws me a 
> org.jdom.input.JDOMParseException: Error on line 1 of document [doc]:
> Dokumentwurzelelement fehlt
> for XML-documents beginning with a BOM when run through JRE 
> 1.4.2, but not
> through 1.5. Documents without BOM work just fine for both 
> JREs. Where could
> that behaviour come from? I'm confused!

The default XML parser in JDK 1.4 is Crimson, the default parser in JDK 1.5
is Xerces. Xerces accepts a BOM marker in UTF-8 files, Crimson does not. The
original XML 1.0 specification was not explicit as to whether a BOM was
allowed in UTF-8 files, this has been clarified in later specs but many
parsers have not been updated.

Michael Kay
http://www.saxonica.com/




More information about the jdom-interest mailing list