Re: [xsl] OT: Schema Q

Subject: Re: [xsl] OT: Schema Q
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 21 Feb 2003 18:45:49 +0000
Hi Sam,

> I am having problems with a XML Schema. I hope that this is not too
> far off topic. If it is, and someone knows of a mailing-list that is
> dedicated to XML Schema, please enlighten me.

Try xmlschema-dev@xxxxxxx See http://www.w3.org/Mail for details about
subscribing.

> My Q:
>
> There once was an element named text:
>
> <text></text>
>
> It always like to hold onto some text:
>
> <text>I am inside!</text>
>
> But sometime it likes to have another element, bob, appear zero or
> more times inside itself:
>
> <text>this is<bob/>all inside<bob/>the element named<bob/>
> text</text>
>
> The question is how is the element text defined in a schema?

Since it can hold elements, it must be an element of a complex type:

<xs:element name="text">
  <xs:complexType>
    ...
  </xs:complexType>
</xs:element>

Since it can also hold text, it must be a complex type with mixed
content:

<xs:element name="text">
  <xs:complexType mixed="true">
    ...
  </xs:complexType>
</xs:element>

Then the content model is just the same as it would be if <text>
*only* held the <bob> elements:

<xs:element name="text">
  <xs:complexType mixed="true">
    <xs:sequence>
      <xs:element ref="bob" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
</xs:element>

Cheers,

Jeni

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


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread