- From: <bgabor@cs.mcgill.ca>
- Date: Thu, 22 Jan 2004 13:45:06 -0500 (EST)
- To: xmlschema-dev@w3.org <xmlschema-dev@w3.org>
Hi,
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:
<myList>
<item1 iName="foo" field1="fixedInt1" field2="fixedString1"/>
<value>"value1"</value>
<item2 iName="bar" field1="fixedInt2" field2="fixedString2"/>
<value>"value2"</value>
...
</myList>
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">
<sequence>
<element name="value" type="string" use="required"/>
</sequence>
<attribute name="iName" type="string"/>
<attribute name="field1" type="int"/>
<attribute name="field2" type="string"/>
</complexType>
<complexType name="itemList">
<sequence>
<element name="item1" type="item">
??? <!-- fix values for attributes here -->
</element>
<element name="item2" type="item">
??? <!-- fix values for attributes here -->
</element>
...
</sequence>
</complexType>
...
Thanks,
Brian Gabor
Received on Friday, 23 January 2004 10:31:10 UTC