W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2004

fix values of complex type's attributes

From: <bgabor@cs.mcgill.ca>
Date: Thu, 22 Jan 2004 13:45:06 -0500 (EST)
Message-ID: <4339.>
To: xmlschema-dev@w3.org <xmlschema-dev@w3.org>

I'm trying to write a schema to represent a list of items, all of the same
type. Each item needs to contain a given set of attributes, and the value
of these attributes for each item needs to be fixed in the schema.
For instance, the resulting XML would look something like this:

  <item1 iName="foo" field1="fixedInt1" field2="fixedString1"/>
  <item2 iName="bar" field1="fixedInt2" field2="fixedString2"/>

where item1, item2, etc. are of type "item" and iName, field1, and field2
are all specified by the schema in each case.
If I create a type "item" as follows, how do I set its attribute values in
my list? Is there an easier way to go about this?

<element name="myList" type="itemList"/>

<complexType name="item">
    <element name="value" type="string" use="required"/>
  <attribute name="iName" type="string"/>
  <attribute name="field1" type="int"/>
  <attribute name="field2" type="string"/>

<complexType name="itemList">
     <element name="item1" type="item">
      ??? <!-- fix values for attributes here -->
     <element name="item2" type="item">
      ??? <!-- fix values for attributes here -->



Brian Gabor
Received on Friday, 23 January 2004 10:31:10 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:04 UTC