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

RE: which xml schema tools do it right concerning including at

  • To: "Paul Hermans" <paul_hermans@p...>,<xml-dev@l...>
  • Subject: RE: which xml schema tools do it right concerning including attributes xml:lang and xml:space
  • From: "Dare Obasanjo" <dareo@m...>
  • Date: Wed, 17 Apr 2002 11:58:42 -0700
  • Cc: <xmlschema-dev@w...>
  • Thread-index: AcHmJDEHNiyWRpxyTv6K5oQpIgBkbAABHVzBAAUUolA=
  • Thread-topic: which xml schema tools do it right concerning including attributes xml:lang and xml:space

ref xml space
*sigh*

After confering with some of our schema folks something was brought up which adds a caveat to my comments.  

A problem arises because the normative schema for Schema (sForS) imports the schema for the XML namespace already. This means that a conformant XSD implementation acts as if the XSD for the "http://www.w3.org/2001/XMLSchema" and "http://www.w3.org/XML/1998/namespace" were imported into any schema it validates. However, Paul is attempting to re-import that namespace using a different schemaLocation and XSD. According to the W3C XML Schema recommendation[0]

"NOTE: The above is carefully worded so that multiple <import>ing of the same schema document will not constitute a violation of clause 2 of Schema Properties Correct (§3.15.6), but applications are allowed, indeed encouraged, to avoid <import>ing the same schema document more than once to forestall the necessity of establishing identity component by component. Given that the schemaLocation [attribute] is only a hint, it is open to applications to ignore all but the first <import> for a given namespace, regardless of the ·actual value· of schemaLocation, but such a strategy risks missing useful information when new schemaLocations are offered."

So this means it is possible for a conformant implementation to ignore a schema author's attempt to re-import the XML namespace and redefine its components. Currently the Microsoft .NET implementation does this but does not issue any warning when it does. 


[0] http://www.w3.org/TR/xmlschema-1/#composition-schemaImport
-- 
PITHY WORDS OF WISDOM 
Lynch's Law: When the going gets tough, everyone leaves.
 
This posting is provided "AS IS" with no warranties, and confers no rights. 
You assume all risk for your use. © 2002 Microsoft Corporation. All rights reserved.



> -----Original Message-----
> From: Dare Obasanjo [mailto:dareo@m...] 
> Sent: Wednesday, April 17, 2002 9:25 AM
> To: Paul Hermans; xml-dev@l...
> Cc: xmlschema-dev@w...
> Subject: RE:  which xml schema tools do it right 
> concerning including attributes xml:lang and xml:space
> 
> 
> Interesting, I was going to suggest looking at the schema For 
> Schema(sForS)[0] as a guide as to the best way of doing this 
> since it doesn't look like the W3C XML Schema recommendation 
> (prose version) clearly spells this out. On looking at the 
> sForS it looks like 
> it assumes that the XML namespace 
> (http://www.w3.org/XML/1998/namespace) is bound to the prefix 
> "xml" without ever declaring this prefix-namespaceURI 
> matching. This is in line with the XML namespaces recommendation[1]. 
>  
> So as for your first question 
>  
> 1. "Now wanting to use these attributes in other schemas some 
> tools require that the 
> namespace ="http://www.w3.org/XML/1998/namespace" is 
> explicitly declared and using the xml prefix 
> is OK." 
>  
> This is incorrect because by definition any tool that 
> supports XML namespaces assumes that namespace is defined for 
> a well-formed XML document. You shouldn't have to explicitly 
> map the "xml" prefix to the 
> "http://www.w3.org/XML/1998/namespace 
> <http://www.w3.org/XML/1998/namespace> " namespace.
>     
> 2. "Other tools refuse the prefix xml since it is reserved 
> for W3C needs and then the following works"
>  
> This is a two part answer. (a.) The XML namespaces 
> recommendation doesn't specify what should happen if one 
> tries to redefine the prefix-namespace mapping for the "xml" 
> prefix so it is understandable for a processor to disallow 
> although a clever one might just allow it if the mapping is 
> too the XML namespace (and thus a NOOP). (b.) If the 
> processor requires the XML namespace to be declared then the 
> behavior is incorrect, see the answer to (1.) above. 
>  
> 3. "Still other tools don't want the namespace declaration at all" 
>  
> This is the behavior most consistent with that of the 
> normative sForS and the XML namespace recommendation. 
>  
> However, I suggest waiting for Jeni or Henry T to pipe in 
> before taking my word for any of this. :) 
>  
> PS: xmlschema-dev is a better list for schema questions. 
>  
> [0] http://www.w3.org/TR/xmlschema-1/#normative-schemaSchema
> [1] http://www.w3.org/TR/1999/REC-xml-names-19990114/#nsc-NSDeclared
> 
> 	-----Original Message----- 
> 	From: Paul Hermans [mailto:paul_hermans@p...] 
> 	Sent: Wed 4/17/2002 8:14 AM 
> 	To: 'xml-dev@l...' 
> 	Cc: 
> 	Subject:  which xml schema tools do it right 
> concerning including attributes xml:lang and xml:space
> 	
> 	
> 
> 	Having in a separate schema file 
> 	<?xml version="1.0"?> 
> 	<schema targetNamespace="http://www.w3.org/XML/1998/namespace" 
> 	          xmlns:xml="http://www.w3.org/XML/1998/namespace" 
> 	          xmlns="http://www.w3.org/2001/XMLSchema" > 
> 
> 	        <attribute name="lang" type="language"/> 
> 
> 	        <attribute name="space" default="preserve"> 
> 	                <simpleType> 
> 	                        <restriction base="NCName"> 
> 	                                <enumeration value="default"/> 
> 	                                <enumeration value="preserve"/> 
> 	                        </restriction> 
> 	                </simpleType> 
> 	        </attribute> 
> 
> 	        <attributeGroup name="specialAttrs"> 
> 	                <attribute ref="xml:lang"/> 
> 	                <attribute ref="xml:space"/> 
> 	        </attributeGroup> 
> 	</schema> 
> 
> 	Now wanting to use these attributes in other schemas 
> some tools require that the 
> 	namespace ="http://www.w3.org/XML/1998/namespace" is 
> explicitly declared and using the xml prefix 
> 	is OK. 
> 
> 	<schema targetNamespace="XXXX" 
> 	        xmlns:xxx="XXXX" 
> 	        xmlns="http://www.w3.org/2001/XMLSchema" 
> 	-->     xmlns:xml="http://www.w3.org/XML/1998/namespace" 
> 	        elementFormDefault="qualified" 
> 	        attributeFormDefault="unqualified"> 
> 	        
> 	        <import 
> namespace="http://www.w3.org/XML/1998/namespace" 
> schemaLocation="xml_tva.xsd"/> 
> 
> 
> 	Other tools refuse the prefix xml since it is reserved 
> for W3C needs and then the following works 
> 
> 	<schema targetNamespace="XXXX" 
> 	        xmlns:xxx="XXXX" 
> 	        xmlns="http://www.w3.org/2001/XMLSchema" 
> 	-->     xmlns:x="http://www.w3.org/XML/1998/namespace" 
> 	        elementFormDefault="qualified" 
> 	        attributeFormDefault="unqualified"> 
> 	        
> 	        <import 
> namespace="http://www.w3.org/XML/1998/namespace" 
> schemaLocation="xml_tva.xsd"/> 
> 
> 	Still other tools don't want the namespace declaration at all 
> 
> 	<schema targetNamespace="XXXX" 
> 	        xmlns:xxx="XXXX" 
> 	        xmlns="http://www.w3.org/2001/XMLSchema" 
> 	-->     
> 	        elementFormDefault="qualified" 
> 	        attributeFormDefault="unqualified"> 
> 
> 	Which one is the correct way ? 
> 
> 
> 	Paul 
> 
> 	        
> 
> 

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.