simple schema Q

Hi,

I have a very simply scema Q.  I am defining a menu in XML and
trying to get the schema put together for it.  The problem I am
having is that a menu must have at least one item element and can
have zero or more itemSep<arators> elements.  I cannot figure out
how to layout the schema for this.  What I have currently is:

<xs:complexType name="menuItem">
  <xs:choice>
    <xs:element name="item" type="itemItem" maxOccurs="unbounded"/>
    <xs:element name="itemSep" type="itemSepItem" minOccurs="0" maxOccurs="unbounded"/>
  </xs:choice>
  <xs:attribute name="id" type="xs:string" use="required"/>
</xs:complexType>

<xs:complexType name="itemItem">
  <xs:sequence>
    <xs:element name="menu" type="menuItem" minOccurs="0"/>
  </xs:sequence>
  <xs:attribute name="name" type="xs:string" use="required"/>
  <xs:attribute name="url" type="xs:anyURI" use="optional"/>
</xs:complexType>

<xs:complexType name="itemSepItem"/>

Sam

P.S.  As you can tell, I name my types based on the element name
then tag Item onto the end.  Is there a standard that I could
adopt? Or at least a better way of doing this?

Received on Sunday, 2 March 2003 20:41:00 UTC