xsd condition

L

Lucia

Hello,

I'd like to write an XML-Schema which has the following structure:

<xsd: complexType name="example">
<xsd: element name="variablename" type="xsd:string"/>
<xsd: element name="variabletype" type="xsd:string"/>
<xsd: element name="variablevalue" type=?????????? />
</xsd:complexType>

My problem is that the type of the element "variablevalue" depends on
the content of the element "variabletype".

e.g. when variablevalue=long, the type of variablevalue should be
"xsd: long";
when variablevalue=string, the type of variablevalue should be
"xsd: string";

How can solve this problem? Have you any idea?

Thanks

lucia
 
M

Martin Boehm

e.g. when variablevalue=long, the type of variablevalue should be
"xsd: long";
when variablevalue=string, the type of variablevalue should be
"xsd: string";

How can solve this problem? Have you any idea?

Create a simpleType for each of the possible variable types and then use
xsd:union or xsd:choice to combine them.

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top