W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2002

RE: [xml-dev] which xml schema tools do it right concerning including attributes xml:lang and xml:space

From: Dare Obasanjo <dareo@microsoft.com>
Date: Thu, 18 Apr 2002 13:44:59 -0700
Message-ID: <8BD7226E07DDFF49AF5EF4030ACE0B7E05C699C2@red-msg-06.redmond.corp.microsoft.com>
To: "Jeni Tennison" <jeni@jenitennison.com>
Cc: "Paul Hermans" <paul_hermans@protext.be>, <xml-dev@lists.xml.org>, <xmlschema-dev@w3.org>
So basically there is a loophole in the spec where although the correct
type information for xml:base, xml:lang and xml:space must be used in a
schema, that the same does not apply for an instance document. Currently
the spec does not explicitly prevent me from specifying that xml:lang
must be an integer between 5 and 10 or that xml:base must only be a date
in an instance document. 

However we do not think that allowing such a loophole to exist and
thereby allowing people to redefine the meanings of xml:base, xml:space
and xml:lang in their schema is desirable. So our implementation assumes
that the XML namespace is imported in every schema it validates and
ignores any re-importation of the XML namespace. 

Thanks for your comments, as usual they were informative and well
thought out. 

-- 
PITHY WORDS OF WISDOM 
The best time to buy something was last year. 
 
This posting is provided "AS IS" with no warranties, and confers no
rights. 
You assume all risk for your use. (c) 2002 Microsoft Corporation. All
rights reserved.



> -----Original Message-----
> From: Jeni Tennison [mailto:jeni@jenitennison.com] 
> Sent: Wednesday, April 17, 2002 4:46 PM
> To: Dare Obasanjo
> Cc: Paul Hermans; xml-dev@lists.xml.org; xmlschema-dev@w3.org
> Subject: Re: [xml-dev] which xml schema tools do it right 
> concerning including attributes xml:lang and xml:space
> 
> 
> Hi Dare,
> 
> > However we don't think that on the one hand an imported schema that 
> > redefines the XML namespace can be ignored when validating 
> the schema 
> > but then on the other hand should override the meaning of 
> the contents 
> > of the XML namespace when using the schema to validate an instance 
> > document. This is rather inconsistent and where I come from we call 
> > that "Crazy Talk"...
> 
> I'm not sure that I follow this (things get rather confusing 
> when you're talking about validating schemas with the SforS, 
> so we might be talking at cross purposes).
> 
> When you validate a schema against the SforS, the SforS is 
> the schema and the schema is the instance. The only imported 
> schemas that are relevant when validating a schema document 
> against the SforS are those schemas that are imported into 
> the SforS. The SforS includes an xs:import for the XML 
> namespace; this imports the definitions in the schema at 
> http://www.w3.org/2001/xml.xsd. Any xs:import elements in the 
> schema that you're validating have no effect on the SforS -- 
> they're just treated as elements like any other.
> 
> So if when you talk about "validating the schema" above, you 
> mean carrying out an XML Schema validation of the schema 
> document using the SforS, then it's true that imported 
> schemas (referenced through xs:import in the schema 
> document), whatever their namespace, can be ignored. At this 
> level, you're checking the XML representation of the schema, 
> nothing more.
> 
> When you actually validate an instance against the schema, 
> though, the schema is turned into an abstract schema 
> information set by parsing the XML representation and 
> resolving the imports, includes and redefines. The only 
> imports, includes and redefines that are used to construct 
> the schema information set are those that are referenced by 
> the schema (and by the things it references, recursively). A 
> validator might ignore certain schema documents if they are 
> imported/included/redefined twice, but otherwise has to 
> resolve them in order to construct the schema.
> 
> So if when you talk about "validating the schema" above, you 
> mean carrying out this validation of the semantics of the 
> schema document and its imports/includes/redefines and the 
> construction of a schema information set, then yes, of course 
> imported schemas cannot be ignored (unless they have already 
> been imported).
> 
> As far as I can see, XML Schema does not provide any special 
> status for the XML namespace. So in a way talking about 
> "overriding the meaning of the XML namespace" doesn't make 
> much sense because as far as a schema validator is concerned, 
> there's nothing to override. The meaning that you provide for 
> that namespace through your imported schemas is really up to 
> you, in just the same way as you can define XHTML or XLink or 
> any other "standard" markup language with whatever schema you 
> like. It's not particular wise, but there's nothing within 
> XML Schema that gives validators special knowledge of any 
> namespaces other than the XML Schema namespaces.
> 
> > If one wants to alter the meaning of the contents of the 
> XML namespace 
> > then <xs:redefine> can be used to achieve that.
> 
> Yes -- you could redefine the schema for the XML namespace at 
http://www.w3.org/2001/xml.xsd, and then import that into your schema.
(But remember that you can only redefine schemas that have the same
target namespace as the schema that you're defining, so you can't use a
redefine instead of an import, only *as well*.)

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Thursday, 18 April 2002 16:45:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:30 GMT