Create xml type with no body

Posted by Pace on Stack Overflow See other posts from Stack Overflow or by Pace
Published on 2010-06-11T16:56:43Z Indexed on 2010/06/11 17:32 UTC
Read the original article Hit count: 300

Filed under:
|

Hopefully this is an easy question. How can I define an XML type such that the type doesn't have a body.

As an example I can define the Foo type as follows...

<xs:complexType name="Foo">
    <xs:simpleContent>
        <xs:extension base="xs:string">
            <xs:attribute name="id" type="xs:integer" use="required"/>
        </xs:extension>
    </xs:simpleContent>
</xs:complexType>

But that would allow the following...

<Foo id="7">STUFF I DON'T WANT</Foo>

Is there a way I can change the xsd so that the Foo element isn't allowed any body?

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xsd