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

Defining content based on attributes

From: Steven Baker <steven.baker@adazzle.com>
Date: Fri, 19 Sep 2003 13:52:24 +0100
To: <xmlschema-dev@w3.org>
Message-ID: <IPEIKBNMPAEEHNFONBIHEEFNDJAA.steven.baker@adazzle.com>
Hi

I am trying to develop a schema for some XML and need to be able to define
what the content of the "input_value" and "output_value" can be depending
upon the value of the field attribute "name" AND the attribute "type"
An example for this XML would be that if the type is "text" then the
input_value is of type xsd:string - if the name is order_no I then want a
restriction to say that this must not be a blank string.
I assume this is all very possible but am struggling to see how - the
examples I have seen all refer to XML structures with unique element names
(not what I want for processing reasons and flexibility in other areas of
the design).
Any help / pointers to good resources would be appreciated.

My XML:
<recordset>
 <record>
  <field name="record_id" type="int" updated="false" table="adazzle"
key="false" unique_id="true" status_field="false">
   <input_value><![CDATA[26]]></input_value>
   <output_value><![CDATA[]]></output_value>
  </field>
  <field name="date" type="date" updated="false" table="adazzle" key="false"
unique_id="false" status_field="false">
   <input_value><![CDATA[04/08/2003]]></input_value>
   <output_value><![CDATA[]]></output_value>
  </field>
  <field name="date" type="date_intl" updated="false" table="adazzle"
key="false" unique_id="false" status_field="false">
   <input_value><![CDATA[20030804]]></input_value>
   <output_value><![CDATA[]]></output_value>
  </field>
  <field name="order_no" type="text" updated="false" table="adazzle"
key="false" unique_id="false" status_field="false">
   <input_value><![CDATA[TESTORDER1]]></input_value>
   <output_value><![CDATA[]]></output_value>
  </field>
    <field name="operator_name" type="text" updated="false" table="adazzle"
key="false" unique_id="false" status_field="false">
   <input_value><![CDATA[]]></input_value>
   <output_value><![CDATA[]]></output_value>
  </field>
 </record>
</recordset>

Many Thanks
Steve Baker
Received on Friday, 19 September 2003 09:04:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:39 GMT