Enumerated complex types

Hello,

I was wondering if the use case of enumerated complex types had ever 
come up in this list. I did a quick search and couldn't find anything.

Here is what I mean:

Let's say I want to define a list of error codes, each having a possible 
value, an associated severity level and description, which I have 
specified in the form of a table, and I want to return in an XML message 
this information in the form of a <Status> aggregate containing a 
<StatusCode> element, <Severity> element and <Desc> element. This is a 
realistic use case you can find in industry standards such as IFX and ACORD.

One solution would be to use co-constraint rules: if StatusCode is '100' 
then Severity must be 'Error' and Desc must be 'General Error', but that 
sounds quite complicated and it wouldn't help the manual edition of a 
schema-compliant XML document.

The alternative solution I'm thinking about would be something similar 
to the xs:restriction and xs:enumeration used in simpleTypes, but with a 
value that would essentially be an XML document fragment.

I see several advantages to this representation:

    * It could be leveraged to accelerate the manual edition of XML
      instances of an XML Schema through code completion: I select one
      of the enumerations in a drop-down list, just like today XML
      editors allow me to select an enumerated value from a drop-down list.
    * It is easier than co-constraint representation for business people
      to understand and edit.
    * It might be easier for type checkers to deal with (intuition).

Let me know what you think and sorry if this has already been discussed.

Guillaume

Received on Thursday, 20 December 2007 00:31:55 UTC