It depends on the type of the parser we are using. Default encoding is UTF-8. If the XML header is defined as <?xml version="1.0" encoding="UTF-16"?>, then the parser will consider UTF-16 encoding. But if the above header is missing or encoding attribute is ignored, default UTF-8 will be considered.
As you said, if the root tag contains 'encoding' attribute, as in the below example, its absolutely programmer's responsibility to tell the parser about the encoding type explicitly. Parser may ignore or respect your command. for ex: <?xml version="1.0"?> <document encoding="UTF-16"> </document> thanks, uma.. On Wed, Jun 10, 2009 at 1:54 PM, Saifi Khan <[email protected]>wrote: > Hi: > > Here is a query regarding XML parser behaviour. > > Consider an XML document without an explicitly stated encoding. > > In that case, what is the encoding the XML parser eg. Xerces > parser uses to start with ? > > Having parsed the root node (virtual in most cases), it > encounters an open tag with UTF-16 encoding. > > In that case, does the XML parser back track to switch to UTF-16 > encoding ? > > Can somebody share some insight in this matter. > > > thanks > Saifi. > > > ------------------------------------ > > > IRC #twincling on irc.freenode.net > Yahoo! Groups Links > > > > > [Non-text portions of this message have been removed]

