Define an XML element that must be empty and has no attributes

Viewed 25950

I needed to define an XML element that has no sub-elements or any content at all, and has no attributes.

This is what I am doing:

<xs:element name="myEmptyElement" type="_Empty"/>
<xs:complexType name="_Empty">
</xs:complexType>

This appears to work fine, but I have to wonder if there is a way to do this without having to declare a complex type. Also, if there is anything wrong with what I have, please let me know.

Anticipating that someone might be curious why I would need such an element: It is for a SOAP operation that does not require any parameter values.

2 Answers
Related