Defining xml in an xsd where an attribute determines the possible contents

Posted by SeanJA on Stack Overflow See other posts from Stack Overflow or by SeanJA
Published on 2010-04-07T14:36:22Z Indexed on 2010/04/07 14:43 UTC
Read the original article Hit count: 188

Filed under:
|
|

How would one go about defining something like this in an xsd?

<start>
    <request type="typeA">
        <elementOnlyFoundInA />
    </request>
    <request type="typeB">
        <elementOnlyFoundInB />
    </request>
</start>

I ran xsd.exe just to get an idea of what it might look like, but it does not appear recognize the relationships between the value of type and the contents of the request. Is it even possible to define contents based on an attribute like this in an xsd file?

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xsd