W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2003

simple schema Q

From: Sam Carleton <sam@linux-info.net>
Date: Sun, 2 Mar 2003 20:39:49 -0500
To: xmlschema-dev@w3.org
Message-ID: <20030303013949.GB11053@miltonstreet.com>


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:element name="item" type="itemItem" maxOccurs="unbounded"/>
    <xs:element name="itemSep" type="itemSepItem" minOccurs="0" maxOccurs="unbounded"/>
  <xs:attribute name="id" type="xs:string" use="required"/>

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

<xs:complexType name="itemSepItem"/>


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

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