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 message
is designed to be simple, and designed to be cross referenced easily. At  
its heart
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>
</key>

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

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

Lastly there is a the recursive structure. Here the value part of the key  
value,
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>
</key>
</key>
</key>

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

Can anyone help?

Thanks

Nick

Received on Monday, 22 March 2010 14:40:51 UTC