Re: Attribute values with unresolved entities

Elliotte Rusty Harold <[email protected]> Mon, 26 Apr 2004 03:17:33 -0400
Newsgroups gmane.text.xml.sax.devel
Message-ID <p0601021fbcb266c7ecdf@[192.168.254.88]>
At 7:25 PM -0400 4/25/04, Michael Glavassevich wrote:

The javadoc for error() refers to the definition of *error* in the 
XML spec, which doesn't require that they be reported, except at user 
option and only for validity constraints. The XML spec is clear that 
reporting this error is not mandatory. SAX doesn't say that parsers 
are required to report all errors defined in the XML spec to error() 
just by virtue of registering an ErrorHandler. I think it only 
imposes the more modest requirement that if an error is reported to 
an ErrorHandler which corresponds to the definition of 'error' in the 
XML spec, it must be reported to error(). Validity constraint 
violations are reported to the error() method when the validation 
feature is true. Unicode normalization errors will be reported to the 
error() method when the unicode-normalization-checking feature is 
true. Perhaps this should be under control of a feature for parsers 
which support reporting such errors.


Excessive configurability is bad design. Calling error() is 
non-fatal, but may well wake somebody up to the problem in their 
documents. It won't happen at all in the common cases where either 
the parser reads the external DTD subset, the document has no 
external DTD subset, the attribute values do not contain externally 
defined entity references, or no ErrorHandler has been registered. 
I'd prefer not to complexify the API by adding an additional feature. 
Nobody is likely to be hurt by reporting this problem to error().

However, somebody could be hurt by a failure to report it. Consider 
in particular the case where the attribute value is nothing but an 
entity reference; e.g. value="&entity;". Currently Xerces and 
probably other parsers would report this value as the empty string. 
If the value has significant impact this could be a real problem.
-- 

   Elliotte Rusty Harold
   [email protected]
   Effective XML (Addison-Wesley, 2003)
   http://www.cafeconleche.org/books/effectivexml            
   http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA 


-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297
_______________________________________________
List: sax-devel, [email protected]
See:  http://www.saxproject.org/
https://lists.sourceforge.net/lists/listinfo/sax-devel