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:complexContent>
    <xsd:restriction base='xsd:anyType'/>
  </xsd:complexContent>
</xsd:complexType>

| 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,
                                          norm

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

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:19 GMT