XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] BOM and encodings questions

Original Message From: "Shlomo Yona"

> .1.
>
> If an XML document starts with the FF FE BOM (UTF-16, little endian) but
> the encoding is set to "UTF-8" in the prolog, what is the expected
> behavior of the Parser?
>
> I think that the parser should respect the BOM, read the prolog assuming
> it is encoded in UTF-16 little endian and then process the remaining of
> the XML document in UTF-8 as the prolog says.
>
> Is this correct?

I don't think so.  I don't think there is any notion in XML that a single 
document (including the Prolog) can be in different character encodings. 
There's also no text that clearly states where any change of character 
encoding of that nature would take place.  e.g. would it be straight after 
the encodingDecl attribute, at the end of the XMLDecl, at the start of the 
element after the XMLDecl?  Without such a statement it's impossible to make 
the switch.

I can't see text that says if you have assessed the encoding to be one 
thing, and the EncodingDecl says it's another thing, then it's an error. 
The nearest thing I can see is:

    "It is a fatal error if an XML entity is determined (via default,
    encoding declaration, or higher-level protocol) to be in a certain
    encoding but contains byte sequences that are not legal in that
    encoding."

> .2.
>
> Is an XML parser expected to process a document in alternating
> encodings? I mean, is there a way to signal the parser that from a
> certain point on the encoding changes to some other encoding? If so,
> how?
>
>
>
> .3.
>
> Is there a way to express the expected encoding of the XML document in
> the XML Schema? If so, how?

No.  They are operating at very different domains.

HTH,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx/
http://www.codalogic.com/lmx/
=============================================




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS