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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] QNames ain't URIs (was QName madness)

[ Lists Home | Date Index | Thread Index ]

*cough* *cough* 
Now I see the problem. You are a victim of the W3C XML Schema (and XQuery) working groups misunderstanding of the Namespaces in XML REC. A QName is a {prefix, localname} pair not a {URI, localname} pair. Unfortunately this definition is so useless that some people have decided to treat it as the latter even though lexically they can't get around the fact that it's the former. 
 
Here's a test question for the  folks that think QNames are isomorphic to URIs. Given the schema 
 
 <xs:schema
 xmlns:xs="http://www.w3.org/2001/XMLSchema";
 targetNamespace="http://www.example.com";
 xmlns:ex="http://www.example.com";
 xmlns:ex2="ftp://ftp.example.com";
 elementFormDefault="qualified">
 
 <xs:element name="Root">
  <xs:complexType>
    <xs:sequence>
     <xs:element name="Node" type="xs:QName" default="ex2:FtpSite" />
    </xs:sequence>
  </xs:complexType>
 </xs:element>
 
</xs:schema>
 
and the instance XML 
 
<Root xmlns="http://www.example.com"; 
  xmlns:ex2="smtp://smtp.example.org" 
  xmlns:foo="ftp://ftp.example.com";>
 <Node />
</Root>
 
In the above scenario what value should be inserted into the Node element upon validation? Should it be "ex2:FtpSite" even the ex2 prefix is mapped to a different namespace in the instance document than in the schema? Maybe it should be "foo:FtpSite" because the prefix "foo" is mapped to the same namespace that "ex2" was mapped to in the schema. But then what would have happened of no XML namespace declaration existed for the ftp://ftp.example.com namespace? Would a namespace declaration have to be inserted into the XML? 

Now ask yourself if the xs:anyURI type has this problem. I can construct similar problems using XQuery but this email is long enough as is. 

 

	-----Original Message----- 
	From: Julian Reschke [mailto:julian.reschke@gmx.de] 
	Sent: Thu 11/14/2002 8:08 AM 
	To: Dare Obasanjo; Simon St.Laurent; XML DEV 
	Cc: 
	Subject: RE: [xml-dev] QNames ain't URIs (was QName madness)
	
	

	> From: Dare Obasanjo [mailto:dareo@microsoft.com]
	> Sent: Thursday, November 14, 2002 5:00 PM
	> To: Simon St.Laurent; XML DEV
	> Subject: RE: [xml-dev] QNames ain't URIs (was QName madness)
	>
	>
	> I have to agree with Simon. I am quite puzzled by John's claim
	> that QNames are isomporphic to URIs.
	
	Sorry?
	
	The trivial proof is to define a function that maps any given QName (URI, local name pair) to a URI. That's not hard to do.
	
	(and no, the generated URIs will not be particulary pretty)
	
	--
	<green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760
	
	





 

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

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