- From: Rob Lugt <roblugt@elcel.com>
- Date: Wed, 18 Jul 2001 13:23:20 +0100
- To: <xml-dev@lists.xml.org>
- Cc: <xml-editor@w3.org>
The XML 1.0 recommendation is clear about how attribute default values should be interpreted:- 4.4 - Parameter Entity references are not recognised 2.3 [AttValue] - General Entity references are expanded 3.3.2 - (updated by errata E9) "The declared default value must meet the syntactic constraints of the declared attribute type" I suspect that the motivation for not allowing parameter entities was to allow implementations to parse the attribute default value exactly as if it occurred in document content. However, when parsing document content the parser knows that all entities will have already been declared, but this is not the case when parsing the DTD. So, implementations using this technique will likely complain if an attribute default value contains a reference to an entity that has not yet been declared. For example, do you think the following XML is valid?. <!DOCTYPE test [ <!ELEMENT test EMPTY> <!ATTLIST test attr CDATA "≥"> <!ENTITY ge "default value"> ]> <test/> It fails in every parser that I have tried (expat, xerces, msxml3, the W3C Validator and our XML Validator) because the general entity ≥ is referenced before it is declared. This seems quite reasonable to me and is nicely consistent, but is it desirable? Some people may find it surprising given that elsewhere in the DTD general entities can be referenced before they are declared. Perhaps it would clarify the situation if the XML 1.0 recommendation made this behaviour explicit. Regards ~Rob -- Rob Lugt ElCel Technology http://www.elcel.com/
Received on Wednesday, 18 July 2001 08:23:34 UTC