Why do I get the error 'Document root element is missing' when loading XML documents in Java?

The Java parser in JDK 1.4 does not support BOM (Byte Order Marker) at the beginning of an xml document. Please see:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6206835

A work around is suggested in the article to remove the BOM, an alternitive would be to specify a different Parser using the JAXP mechanism as described in the JAXP documentation.

In the Liquid XML Studio, an option to write the BOM (default) or not for compatibility with older applications is available. Please see:
http://www.liquid-technologies.com/SmarterTrack/KB/a4/byte-order-marker-bom.aspx

Add Feedback