xsd condition

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lucia

    #1

    xsd condition

    Hello,

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

    <xsd: complexType name="example">
    <xsd: element name="variablen ame" type="xsd:strin g"/>
    <xsd: element name="variablet ype" type="xsd:strin g"/>
    <xsd: element name="variablev alue" type=?????????? />
    </xsd:complexType >

    My problem is that the type of the element "variableva lue" depends on
    the content of the element "variablety pe".

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

    How can solve this problem? Have you any idea?

    Thanks

    lucia
  • Martin Boehm

    #2
    Re: xsd condition

    "Lucia" <cheng_lucia@ya hoo.com> wrote in message
    news:7390d0bf.0 310220341.36ab6 f8b@posting.goo gle.com
    [color=blue]
    > e.g. when variablevalue=l ong, the type of variablevalue should be
    > "xsd: long";
    > when variablevalue=s tring, the type of variablevalue should be
    > "xsd: string";
    >
    > How can solve this problem? Have you any idea?[/color]

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

    Martin


    Comment

    Working...