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

Namespaces, Xml Schema Whitespace normalization, xs:anyURI, and URILiter

  • To: xml-dev@l...
  • Subject: Namespaces, Xml Schema Whitespace normalization, xs:anyURI, and URILiteralsin XPath 2.0
  • From: Jeff Rafter <lists@j...>
  • Date: Mon, 27 Mar 2006 11:10:28 -0800
  • Reply-to: lists@j...
  • User-agent: Thunderbird 1.5 (Windows/20051201)

xml whitespace normalization
I was considering filing a bug in the bugzilla db for XPath 2.0 but 
decided that I am so unsure about the issue that I would bring it here 
for a little discussion (and if that subject line can't start a 
permathread, I don't know what can).

In XPath 2.0 (CR) many of the namespace properties are defined as 
xs:anyURI with requirements on whitespace normalization defined in the 
XML Schema spec. Now, I am not sure which rules are being referred to 
but I can only guess that they are the whitespace normalization rules in 
the structures spec [2] because there are no rules for normalization in 
the updated wording in the errata for xs:anyURI [3]. Michael Kay's 
corrective wording for URILiteral is:

"The URILiteral is subjected to whitespace normalization as defined for 
the xs:anyURI type in [XML Schema]: this means that leading and trailing 
whitespace is removed, and any other sequence of whitespace characters 
is replaced by a single space (#x20) character. Whitespace normalization 
is done after the expansion of CharRefs, so writing a newline (say) as 
&#xA; does not prevent its being normalized to a space character." [4]

Now this leads me to my larger question: is whitespace normalization 
allowed for namespace declarations? If not, does this ruin their 
comparability? In Namespaces in XML 1.1 (I am using 1.1 because it 
contains better wording for what was already understood in 1.0), it 
states that namespaces must be compared lexically and that the 
comparison should take place after attribute normalization (so CharRefs 
are expanded) [5]. Because of this, you may end up with a 
single-normalized namespace IRI/URI and a double-normalized namespace 
property in XPath 2.0. Consider the namespace name:

   xmlns:foo="http://www.example.com/Example with two &#x20;spaces"

The namespace name will be viewed as (after normalization):

   http://www.example.com/Example with two  spaces

While the doubly normalized property value will be (after XML Schema 
whitespace normalization):

   http://www.example.com/Example with two spaces

If this is true then lexical comparison will fail. Is this accurate?


[1] http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/
   * Note, XPath 2.0 refers to the REC first edition not the SE

[2] 
http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#section-White-Space-Normalization-during-Validation

[3] http://www.w3.org/2001/05/xmlschema-errata#e2-11

[4] http://www.w3.org/Bugs/Public/show_bug.cgi?id=2462

[5] http://www.w3.org/TR/xml-names11/#IRIComparison


Thanks,
Jeff Rafter

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.