[xml] General XML Schema question



Hi,

I'm not aware of any other XML mailinglist, forum or whatever so I would
like to post my question here in the hope that someone else has an idea.

This is the scenario, an enumerator which should specify of which type a
special subset of my XML file is.

<xsd:simpleType name="myType">
  <xsd:restriction base="xsd:string">
    <xsd:enumeration value="MY_SPECIAL_TYPE_STRING"/>
    <xsd:enumeration value="MY_SPECIAL_TYPE_INTEGER"/>
    <xsd:enumeration value="MY_SPECIAL_TYPE_OF_WHATEVER"/>
  </xsd:restriction>
</xsd:simpleType>

and a complexType which holds the actual enumerator type and the value
itself.

<xsd:complexType>
  <xsd:sequence>
    <xsd:element name="Type" type="myType"/>
    <xsd:element name="Value" type="xsd:string"/>
  </xsd:sequence>
</xsd:complexType>

Now I would like to create a rule which says for example if the user
chose the enumerator MY_SPECIAL_TYPE_STRING than the type of "Value" has
to be "xsd:string". If the enumerator was MY_SPECIAL_TYPE_INTEGER than
the type of "Value" should be "xsd:integer". And maybe if this is even
possible create my own type for "Value".

I'm not sure if this is even possible with XML Schema. I guess I have to
do it programmatically but I would like to hear a second opinion.

Best regards
Stefan

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]