Stop node containing subnodes and text in schema

Posted by AndyC on Stack Overflow See other posts from Stack Overflow or by AndyC
Published on 2010-04-02T14:37:29Z Indexed on 2010/04/02 15:03 UTC
Read the original article Hit count: 189

Filed under:
|
|
|

If I have some xml like this:

<mynode>
    <mysubnode>
        <mysubsubnode>hello world</mysubsubnode>
        some more text
    </mysubnode>
</mynode>

As you can see, mysubnode contains both a subnode and some text data.

What I want to know is, is it possible to prevent this happening in a schema? I don't want nodes to contain subnodes and text, just subnodes or text.

Is there an option in my xsd I can specify to force this?

My program to that uses this xml is written in .NET, so I'll tag it as well incase there's anything of use in .net that I can utilise for this, though I'd much rather that the issue was fixed in the schema itself.

Cheers

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xsd