Re: multiple type definitions for elements with the same name

(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">
  <simpleContent>
    <extension base="conditionType">
      <attribute name="gender" ... />
    </restriction>
  </simpleContent>
</complexType>

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

.. and so on...

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

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.


regards,
----------------------
K.Kawaguchi
E-Mail: kohsukekawaguchi@yahoo.com

Received on Thursday, 7 June 2001 16:20:46 UTC