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

Hi Dare,

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

Isn't this mixing two different levels -- the schema for schema
validating the schema and the schema validating the instance? When
you're looking at validating the instance, it shouldn't matter what
gets defined or imported in the schema for schema (which might be used
for validating the schema). If you followed that logic, then the
various other definitions and declarations in the schema for schema
would be present in every schema, and every schema would validate an
instance document that was an XML Schema.

(Of course there are some definitions and declarations that make it
into all schemas, but these are explicitly listed as "built-in" -- I
can't see anywhere where it says that the Schema for Schemas is
imported into all schemas.)

So I don't think that Paul's importing of the XML namespace should be
a problem here.

As far as what he should do, as far as I can see, the XML Schema spec
makes no mention of built-in definitions for the various attributes in
the XML namespace, so to refer to them they have to either be declared
somewhere or there has to be a basic xs:import that just references
the XML namespace:

  <xs:import namespace="http://www.w3.org/XML/1998/namespace" />

and then a attribute wildcard that says you can use any of them, and
does 'lax' or 'skip' validation so that it doesn't matter that the
declarations are missing:

  <xs:anyAttribute namespace="http://www.w3.org/XML/1998/namespace"
                   processContents="lax" />
  
This has the advantage that when new XML attributes come along (e.g.
xml:id if that ever takes off) they'll be allowed by the schema. But
it has the disadvantage that it doesn't enable you to constrain the
values of these attributes (e.g. to constrain xml:lang so that it can
only have the values 'en' or 'fr').

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Wednesday, 17 April 2002 16:00:01 UTC