[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
W3C XML Schema is more than "close by default) (Re: [xml-dev] annotations outside validation)
Hi Rick,
Rick Jelliffe wrote:
> Imagine a schema language that took the namespace mechanism seriously
> enough to let you put elements or attributes from any different namespace
> anywhere: open by default unless the schema specifically denies it for some
> elements. And imagine if this schema language also aided this by not forcing
> any spurious decisions about element ordering, where none was strictly required.
> If you used such a schema language it would be easy to write your schemas
> to maintain openness.
>
> Schematron is one such language. (XML Schemas is not, because you have
> to do extra work to get openness rather than it being the default.)
I wish W3C XML Schema could be replaced by Schematron as a fundation of XML in
TBL's drawings!
The problem here for W3C XML Schema is worse than being a matter of
adding wildcards --which would be a syntaxic issue which could be solved
by a simple XSLT transformation that would preprocess a schema to add
the wildcards.
The problem with W3C XML Schema, its "Unique Particle Attribution rule"
(called non-deterministic data models in XML) and the lack of
flexibility of its wildcards namespace definitions is that as soon as
you have 2 namespaces in a schema there are many cases where you can't
open you schema to unknown namespaces any longer.
If your target namespace is ns1 and you have:
<xs:element name="foo">
<xs:complexType>
<xs:sequence>
<xs:element ref="ns1:bar"/>
<xs:element ref="ns2:bar"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<note for="the happy W3C XML Schema illetrates">
This is a simple content model allowing:
<ns1:foo>
<ns1:bar/>
<ns2:bar/>
</ns1:foo>
</note>
you can't add any longer a wildcard (at least you can't
immediatly after or before ns2:bar) in the sequence since
you can't specify in a wildcard that you accept any namespace
except those defined nor even that you accept any namespace
except ns1 and ns2.
The closest choice which you have (any namespace except the target) cannot
be used either since it would accept ns2 and break the Unique Particle
Attribution rule.
The workaround proposed by the WG against this is to add containers in your
content model and open to other namespaces in these containers.
<note for="the happy W3C XML Schema illetrates">
Such as:
<ns1:foo>
<ns1:bar/>
<ns2:bar/>
<ns1:extensions>
Here (and only here) I can add what I want
</ns1:extensions>
</ns1:foo>
</note>
This is the main reason why we have decided that RSS 1.0 would not be
"W3C XML Schema descriptible"...
>
> Schema languages which default to closed stifle freeform modularity
> using namespaces.
This is IMO a major flaw in W3C XML Schema do not only "default to
closed" but also "prevent to open".
<rant>
I believe that W3C XML Schema has missed here its goal of "supporting the
namespaces" and that it's one of the reasons why this rec is not ready to
be used as a fundation for other recs such as XPath 2.0 (even though it
can already be useful for application vocabularies).
This is also one of the reasons why I strongly believe that alternative
ways MUST be found to create a PSVI (such as what I have called "little
intrusive PSVI).
This is not a detail IMO, but a matter of survival for truly open XML
applications since despite my rants, everything show that W3C XML Schema
will be used as a fundation!
</rant>
Eric
--
Rendez-vous à Paris pour le Forum XML.
http://www.technoforum.fr/Pages/forumXML01/index.html
------------------------------------------------------------------------
Eric van der Vlist http://xmlfr.org http://dyomedea.com
http://xsltunit.org http://4xt.org http://examplotron.org
------------------------------------------------------------------------