W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2000

Some questions on specifying empty XML elements

From: Gino Basso <GBasso@ware2.com>
Date: Tue, 28 Nov 2000 16:41:38 -0500
Message-ID: <8022A77178C84548B49F5965D38776C805F347@wopr.ware2.com>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
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" />


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

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

Comments on any of the above would be appreciated.

Gino Basso
Ware2 Software Corp.
Received on Tuesday, 28 November 2000 16:41:47 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:49 UTC