[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Attribute default values containing entity references

  • From: Rob Lugt <roblugt@e...>
  • To: xml-dev@l...
  • Date: Wed, 18 Jul 2001 13:23:20 +0100

xml ge
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 "&ge;">
<!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 &ge; 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/



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.