Re: [xsl] Encoding problem or what else?

Subject: Re: [xsl] Encoding problem or what else?
From: George Cristian Bina <george@xxxxxxxxxxxxx>
Date: Thu, 08 Dec 2005 10:16:29 +0200

Xerces handles the UTF-8 BOM correctly since many years now. What you need to check is how you create the input source for the XML that you pass to the transformation. If you pass only the system ID then Xerces will escape automatically the BOM if the encoding is UTF-8. If you pass a Reader to the parser then it is your task to skip the UTF-8 BOM. IIRC there is a bug on Sun bugzilla that says that the InputStreamReader does not skip the UTF-8 BOM when you give it a UTF-8 byte stream.

Now the error message: "Document root element is missing." seems different than what Xerces gives if you enter a character before the XML header: "The processing instruction target matching "[xX][mM][lL]" is not allowed." so it is possible that you are using some other XML parser.

Hope that helps,
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger

Current Thread