Hi,
        I am using a parser (not xerces) that does not detect
the encoding on it's own. I want to add the handling
of detecting the encoding. I downloaded the source for
xerces-1_4_4 and went through the handling. I have
found out that xerces is doing this with the help of 3
utility classes viz. EBCDICRecognizer.java,
UCSRecognizer.java and UTF8Recognizer.java. My
question is, are these 3 classes taking care of
(detecting) all the encodings that java supports? If
yes, just to know, can you tell me, how does it do
that? What is UCS encoding?

Thanks,
        Nikhil

 Jan Dvorak  wrote:Hi,No, you don't specify any
encoding for the InputStream.The parser takes care of
this. It works approximately like this: The parser
detects whether it's an 8-bit or an 16-bit encoding
from the very first bytes of the stream and then it
reads up to the end of the thing. There shouldn't be
any other characters than the usual US-ASCII ones, so
no risk of confusion. As it encounters the
encoding="..." part, the parser switches the reader
for the stream to the specified encoding. Then it
reads through the rest of the stream.JanDne středa 13
listopad 2002 07:41 


Nikhil Khedkar napsal(a):| Hi,| if I want to pass
InputStream to the parser's parse method, do I need
to| set the encoding of InputStream, equals to the
attribute encoding="xyz",| the xml file has? Or the
parser takes care of this encoding and the|
InputStream need not bother about it? Basically my
requirement is, I want| to parse xml file, whose
encoding I do not know, using parse method, which|
takes InputStream. Is the file's encoding (i.e. the
one in which the file| is saved) and the attribute,
encoding="xyz" must be same. My question is,| if the
parser takes care of the encoding, how does it make
sense from| InputStream and fetch the encoding,
because even to parse the first line| having encoding
attribute, it has to know the encoding of
InputStream?|| Thanks,| Nikhil|||||||||
---------------------------------| Get a bigger
mailbox -- choose a size that fits your
needs.---------------------------------------------------------------------To
unsubscribe, e-mail:
[EMAIL PROTECTED] additional
commands, e-mail: [EMAIL PROTECTED]

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to