You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Gary Kephart <ga...@emotion.com> on 2000/09/07 00:51:01 UTC
Re: The root element is required... [was Re: An invalid XML character
(Unicode: 0x0)...]
Eric Ye wrote:
> Your new approach still didn't solve the Byte Order Mark problem.
>
> You have to convert the byte stream to be UTF-8 encoded and strip off the 2
> byte order mark bytes (0xFE 0xFF or 0xFF 0xFE) in the very beginning after
> the detection of byte order.
>
> or you 'll need to ask the source of the stream to add encoding decl, it
> would be a very reasonable request because the file you received from the
> socket is not even a well-formed xml file.
Thanks for your help. I'm glad there's people out there who help us XML newbies.
It seems, though, all I needed to do is call
inputStream.setEncoding("UnicodeBig")
and all of a sudden my program could read from the socket.
It looks as though Java already has some IO set up for this type of encoding. I
eventually found my answers in the following URLs:
http://grove.ufl.edu/usr/share/doclib/java/api/Package-sun.io.html
http://grove.ufl.edu/usr/share/doclib/java/api/sun.io.CharToByteUnicodeBig.html#_top_
http://grove.ufl.edu/usr/share/doclib/java/api/sun.io.CharToByteUnicodeBigUnmarked.html#_top_
Gary
--
Gary Kephart, Software Engineer | eMotion, Inc.
Phone: (310)914-2771 | 11835 West Olympic, Suite 1000
Fax: (310)479-8480 | Los Angeles, CA 90064
mailto:gary_kephart@acm.org | http://www.emotion.com
Team Ada member | "Digital Media Management"
Disclaimer: these are my opinions, not eMotion's.