OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] can you use inheritance (extension) in relax ng?

[ Lists Home | Date Index | Thread Index ]

On Mon, 2003-10-27 at 02:26, Bob Foster wrote:
> Gustaf Liljegren wrote:
> > At 06:54 2003-10-25 -0700, Dare Obasanjo wrote:
> > 
> >>As a document validation language RNG is simpler, more
> >>expressive and less verbose than W3C XML Schema. As a
> >>datayping language W3C XML Schema is the only game in
> >>town [...]
> > 
> > Can you (or someone else) elaborate on this? I don't understand what
> > features are missing från RNG as a "datatyping language" (what's that?). It
> > has the existing datatypes from WXS, it has the ability to construct regex
> > patterns, it has named patterns for complex types. What's not there?
> 
> RNG doesn't have type derivation. You can parameterize an existing type 
> but you can't define a new named type based on an existing one.

W3C XML Schema has several kinds of type derivation, which do very
different things. I'm guessing you're talking about simple type
derivation by restriction.  There's some more about this here:

http://lists.xml.org/archives/xml-dev/200307/msg00342.html

> RNG doesn't have "complex types" at all. One might argue that nothing is 
> better than XML Schema's faux-OOP extension types, but a case could be 
> made for named patterns.

You can name patterns with a <define>.

> Some think it handy in a query language to 
> know, e.g., that all arguments to a function match a certain pattern. 
> (Some don't.)

A query language could easily refer to definitions in a RELAX NG schema.

I think the deeper issue is named v structural typing, which is related
to your next point.  W3C XML Schema is designed for named typing; RELAX
NG is designed for structural typing. I strongly believe that named
typing is not the right choice for XML, because it results in
unnecessarily tight coupling. 

> More subtly, RNG is designed for validation, not type assignment. 
> Because RNG patterns are closed under union, it can easily happen that a 
> given sequence is valid according to more than one pattern, and there is 
> no decision procedure to choose which pattern to use in assigning a 
> type. XML Schema resolves such issues by a "first match" rule for its 
> union (simple) types and by disallowing ambiguity in complex types.

The base spec doesn't build in a particular algorithm for type
assignment, because there is no need for this to be part of the base
spec.  If there's a need for a single standard way of doing type
assignment, it can easily done in a separate layered spec.  This spec
would identify additional restrictions on RELAX NG schemas. There could
be an extension attribute that schemas would use to declare that they
are intended to meet these restrictions.  In this way, people who don't
care about type assignment wouldn't have to be inconvenienced by
unnecessary restrictions.

So far we haven't actually done such a spec.  I don't see much demand
for it.  Communities for which type assignment are important seem
already heavily committed to W3C XML Schema, and nothing RELAX NG is
likely to make any difference.  The absence of a spec hasn't stopped
people writing tools that do type assignment with RELAX NG (e.g. Relaxer
and RelaxNGCC). Experience with these tools has also shown that there's
not a single natural way to do type assignment. Different kinds of tools
need different kinds of restriction.  It would be possible to
arbitrarily pick one such set of restrictions, that's not really the
RELAX NG way.

James






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS