Some questions on specifying empty XML elements

I'm trying to duplicate the following DTD in an XML schema:

    <!ELEMENT nothing EMPTY>

So far I have two possibilities:

    <complexType name="EmptyType" />
    <element name="nothing" type="EmptyType" />

or

    <element name="nothing">
        <complexType />
    </element>

Are these correct? equivalent? other alternatives?

What about XML instances? While XML itself provides two mechanisms for
indicating that an element does not have any content, <nothing></nothing>
and <nothing/>, it is a violation of the specification to use the former if
the associated DTD declares the element to be EMPTY (as with the DTD above).
What about when validating an instance against either of the above schemas?
Does the schema specification distinguish between the two mechanisms for
indicating empty content?

Finally, it seems curious to me that the schema:

    <element name="something" />

allows for any content. I would have thought it safer (and simpler) to not
allow any content (as with the above definition for the complex type
'EmptyType').

Comments on any of the above would be appreciated.

Thanks,
Gino Basso
Ware2 Software Corp.

Received on Tuesday, 28 November 2000 16:41:47 UTC