Empty AttlistDecl

David Megginson (ak117@freenet.carleton.ca)
Tue, 27 Jan 1998 08:44:44 -0500


Stefan Mintert writes:

> What's the purpose of an empty AttlistDecl?
> Shouldn't production [52] read instead as follows?
>
> AttlistDecl ::= '<!ATTLIST' S Name AttDef+ S? '>'
>
> (+ instead of *)

Actually, it turns out to be remarkably useful for external DTD
subsets. Consider this:

<![%security;[
<!ENTITY % security-atts "
level CDATA #REQUIRED
auth CDATA #REQUIRED">
]]>
<!ENTITY % security-atts "">

<!ATTLIST section %security-atts;>

Now, if the %security; parameter entity is set to "INCLUDE" (to enable
security features), you will get

<!ATTLIST section
level CDATA #REQUIRED
auth CDATA #REQUIRED>

If the %security; parameter entity is set to "IGNORE" (to disable
security features), you will get

<!ATTLIST section>

Fortunately, this is still legal in XML.

All the best,

David

-- 
David Megginson                 ak117@freenet.carleton.ca
Microstar Software Ltd.         dmeggins@microstar.com
      http://home.sprynet.com/sprynet/dmeggins/

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)