OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



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

[ Lists Home | Date Index | Thread Index ]

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 

 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  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


[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

Jeff Rafter


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

Copyright 2001 XML.org. This site is hosted by OASIS