[
Lists Home |
Date Index |
Thread Index
]
- From: Henry Thompson <ht@cogsci.ed.ac.uk>
- To: xml-dev@ic.ac.uk
- Date: 27 Jan 1998 09:25:28 +0000
Bill Wendling <wendling@ganymede.isdn.uiuc.edu> writes:
> Is there a way in XML to make a tag conditionally empty? That is, if you
> have this declaration:
>
> <!ELEMENT syntax - - (attr)*>
> <!ATTLIST syntax TYPE (brief | full) brief>
> <!ATTLIST syntax ATTRSET CDATA #IMPLIED>
>
> if the attrset attribute of syntax has a value, could the user type it as:
>
> <syntax attrset="foo"/>
>
> instead of
>
> <syntax attrset="foo">
> </syntax>
Both of those are valid (and I use the word carefully) XML regardless
of the declaration of the attribute and almost* regardless of the
content model of the element. The proposed recommendation text reads
"Empty-element tags may be used for any element which has no content,
whether or not it is declared using the keyword EMPTY."
So you can write what you wanted, but you can't get a guarantee that
you've only used the empty tag when the attribute is present.
*The only case either would be invalid is when both would be invalid,
e.g. because the content model for 'syntax' and some REQUIRED content.
ht
--
Henry S. Thompson, Human Communication Research Centre, University of Edinburgh
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
URL: http://www.cogsci.ed.ac.uk/~ht/
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
- References:
- Empty Tags
- From: Bill Wendling <wendling@ganymede.isdn.uiuc.edu>
|