xsl-list
[Top] [All Lists]

Re: OT: Schema Q

2003-02-21 11:45:49
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(_at_)w3(_dot_)org(_dot_) 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



<Prev in Thread] Current Thread [Next in Thread>