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

RE: QNames ain't URIs (was QName madness)

  • To: "Julian Reschke" <julian.reschke@g...>,"Simon St.Laurent" <simonstl@s...>,"XML DEV" <xml-dev@l...>
  • Subject: RE: QNames ain't URIs (was QName madness)
  • From: "Dare Obasanjo" <dareo@m...>
  • Date: Thu, 14 Nov 2002 08:19:23 -0800
  • Thread-index: AcKL+AexaX6UsyoOQd+RmULtRiKQLQAAKZLu
  • Thread-topic: QNames ain't URIs (was QName madness)

qname example
*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@g...] 
	Sent: Thu 11/14/2002 8:08 AM 
	To: Dare Obasanjo; Simon St.Laurent; XML DEV 
	Cc: 
	Subject: RE:  QNames ain't URIs (was QName madness)
	
	

	> From: Dare Obasanjo [mailto:dareo@m...]
	> Sent: Thursday, November 14, 2002 5:00 PM
	> To: Simon St.Laurent; XML DEV
	> Subject: RE:  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
	
	


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.