I am a newbie to schema definitions so forgive me if this is a simple
question.
I am trying to create a schema for a complex type that allows
instances of either of the two forms:
<test1 state=true>
<name>test1/>
<type>typeA/>
</test1>
<test2 state=false>
<name>test2/>
<type>type@/>
</test2>
Here the 'type' element is a string without the '@' character if
'state' is true and a string with the '@' character when state is
false.
XML Schemas don't allow you to select between two different types of
content based on the value of a variable -- *EXCEPT* by making the two
types of content subtypes of a single type, and then using the xsi:type
attribute to switch between them. If you are willing to replace your
"state" with that directive, you can make this work. Otherwise, do this
cross-dependency check in your application code, or investigate whether
your environment supports any of the other schema languages.
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
http://www.liquid-technologies.com/Product_XmlStudio.aspx
Regards Jason