W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2001

Re: multiple type definitions for elements with the same name

From: Kohsuke KAWAGUCHI <kohsukekawaguchi@yahoo.com>
Date: Thu, 07 Jun 2001 13:20:30 -0700
To: "Noel Bush" <noel@alicebot.org>
Cc: xmlschema-dev@w3.org
Message-Id: <20010607090136.48D2.KOHSUKEKAWAGUCHI@yahoo.com>

(Jeff Rafter wrote)
> I don't think you can do exactly what you want-- much of what you are
> looking for includes co-constraints (if attribute x, then element y).
> Co-constraints can be expressed using a tool like Schematron in conjunction

While I agree that Noel can't get what he wants, (she? I'm sorry. I'm
not good at telling the gender from the name..),  the problem is not
because of the so-called "co-constraints".

But I think XML Schema can be abused to better model Noel's language.
How about this?

<!-- make it a "ur-type" and abstract -->
<simpleType name="conditionType" abstract="true" />

<complexType name="conditionType.single">
    <extension base="conditionType">
      <attribute name="gender" ... />

<complexType name="conditionType.list">
    <extension base="conditionType">
        <!-- use local element declaration so that you can define
              li for different purposes later -->
        <element name="li" maxOccurs="unbounded">
              <extension base="string">
                <attribute name="gender" ... />
                <attribute name="name" ... />

.. and so on...

<element name="condition">
  <complexType ref="conditionType"/>

But certainly you can't capture the "default list condition".

Also, you may want to check out different languages like RELAX, TREX, or
RELAX NG. Things like this are as easy as ABC.

E-Mail: kohsukekawaguchi@yahoo.com
Received on Thursday, 7 June 2001 16:20:46 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:52 UTC