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 <?xml .... ?> 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. Jan Dne 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] For additional commands, e-mail: [EMAIL PROTECTED]