Re: XML Schema compliance

Hi Savas,

>> Purists would probably argue you should include
>> 
>> <xs:import namespace="http://www.w3.org/2001/XMLSchema"/>
>
> I believe that this is not necessary. When you define an XML Schema,
> the above namespace is assumed to be already imported.

I disagree with this assertion (which I guess makes me a purist). The
XML Schema Recommendation states that certain types are built-in to
the language (xs:anyType, xs:anySimpleType and the various built-in
data types). The Rec does not state anywhere that I can see that the
Schema-for-Schema is imported into all schemas. So to reference
element and attribute declarations, type definitions and so on from
the Schema-for-Schema, you must import it just as you must import a
schema for the XML namespace if you want to use that, or a schema for
the XHTML namespace if you want to use that.

> Here's why I believe that "xs:element" cannot be used as base in an
> XML Schema declaration.
>
> The XML Schema infoset defines a tree of information items with the
> {namespace} property for all of them set to
> "http://www.w3.org/2001/XMLSchema" (section 3.1.2).

I'm not sure what you mean by the "XML Schema infoset" in the above,
but I think you're saying that the Schema-for-Schema defines a set of
schema components that share the target namespace of
"http://www.w3.org/2001/XMLSchema", which is true.

> So, when one uses
>
> <xs:restriction base="xs:element">
>
> What should a tool do? Should it refer to the "element" complex type
> defined in http://www.w3.org/2001/XMLSchema by the normative XML
> Schema or should it refer to the more general,
> representation-independent XML Schema information item defined by
> the XML Schema infoset in the same namespace?

It should refer to the type definition for xs:element as imported into
the schema. If the <xs:import> element for the
http://www.w3.org/2001/XMLSchema namespace has a schemaLocation
attribute then it could use that as a hint for locating a
Schema-for-Schema at the specified URI, but I think an implementation
is free to use the schema components from an internal
Schema-for-Schema if it prefers to do so.

Cheers,

Jeni

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

Received on Wednesday, 2 July 2003 17:45:27 UTC