[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: BOM and encodings questions

  • From: "Pete Cordell" <petexmldev@t...>
  • To: "Shlomo Yona" <S.Yona@F...>, <xml-dev@l...>
  • Date: Thu, 8 Mar 2007 17:39:41 -0000

Re:  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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.