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

Re: Some questions on specifying empty XML elements

From: Norman Walsh <ndw@nwalsh.com>
Date: 29 Nov 2000 06:24:17 -0500
To: xmlschema-dev@w3.org
Message-ID: <87y9y3f2ce.fsf@nwalsh.com>
/ Gino Basso <GBasso@ware2.com> was heard to say:
| I'm trying to duplicate the following DTD in an XML schema:
|     <!ELEMENT nothing EMPTY>

I think the way to do this is:

<xsd:complexType name='EmptyType'>
    <xsd:restriction base='xsd:anyType'/>

| 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).

That's not the case. <nothing/> and <nothing></nothing> are equivalent
and both are legal if the element nothing is declared EMPTY in an XML DTD.

| 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?

No. There is no distinction.

                                        Be seeing you,

Norman Walsh <ndw@nwalsh.com> | We dance around in a ring and suppose,
http://nwalsh.com/            | but the Secret sits in the middle and
                              | knows.--Robert Frost
Received on Wednesday, 29 November 2000 06:28:15 UTC

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