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

RE: Recursive XSD Design

From: Michael Kay <mike@saxonica.com>
Date: Mon, 22 Mar 2010 15:16:14 -0000
To: <nickle@gmail.com>, <xmlschema-dev@w3.org>
Message-ID: <03D19612906B478289AC5008E1D12581@Sealion>
The interesting thing is that the usual reason people do
<field name="N" value="V"/>
rather than
is that they DON'T want to be constrained a schema; they somehow feel that
the "generic" (verbose) form is more extensible than the concise form.
You can use the generic design if you like. Personally I really don't see
the point of it. XSD 1.0 doesn't support it, in the sense that it doesn't
allow the type of V to depend on the value of N. XSD 1.1 has a feature
called "conditional type assignment" that fills this gap. But I still think
it's a curious way to design your XML.

Michael Kay


From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of nickle@gmail.com
Sent: 22 March 2010 11:42
To: xmlschema-dev@w3.org
Subject: Recursive XSD Design

I'm having trouble creating an XSD for some xml.

A bit of background might help. The xml is for messaging. In particular, the
is designed to be simple, and designed to be cross referenced easily. At its
is a recursive key value set up. 

Simple Key values are like this.

<key name="quantity">5</key>
<key name="price" representation="percentage">99.78</key>

There is an optional representation attribute where the infromation
could be represented in two different forms.

Reference Key Values are like this

<key name="currency" reference="instrument">
<id name=" INSID" system="XXXX" instance="PROD">DEM</id>
<id name=" EXTERN_ID1" system="XXXX" instance="PROD"> ext128k</id>

This form is used for foreign key references or for references to
The cross reference service will select out all keys with an attribute of
It will then get all possible ids for that reference, and add in additional
fields, and replace that sub element with the new version.

ie ".//key[@reference]" as an Xpath can get all the enumerations and
from the xml

Lastly there is a the recursive structure. Here the value part of the key
can be a key value itself.

<key name="trade" type="trade">
<key name="value_day">1999-03-12</key>
<key name="quantity">5</key>
<key name="leg" type="leg">
<key name="rate">5.00</key>
<key name="period">3m</key>
<key name="cashflows" type="cashflows">
<key name="cashflow">10</key>
<key name="cashflow">20</key>

Now, I'm having real trouble creating an XSD for this structure.

Can anyone help?


Received on Monday, 22 March 2010 15:16:43 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:55 UTC