RE: CDATA in attribute values

> From:	Christian Smith [SMTP:csmith@barebones.com]
> 
> I this valid?
> 
> <img src="foo.gif" alt="<![CDATA[ Jack & Jill ]]>" />
> 
	[DJW:]  No.

	Naked &'s and <'s are not permitted in attribute
	values, and XML directives are definitely not
	recognized in that context.

	See 
	<http://www.w3.org/TR/2000/REC-xml-20001006#sec-common-syn>,
production number [10].

	Whilst it is just conceivable that some version of XHTML
	has extended ALT to allow it to include XML text for
	recursive expansion, such a change would not be understood
	by a general validator, because it requires knowledge beyond
	the content of the DTD, and would not be backwards compatible,
	because of the need to double escape < when one doesn't
	want interpreted as the start of a tag.

	The comment that someone made about the validator is probably
	referring to the fact that it fails to fault the use of
	< in the value; a rule that is probably in there to allow
	rapid error recovery.  As far as I know, an SGML parser
	(e.g. one for HTML) should not recover from an unclosed 
	quote on seeing a new tag.  The validator is based on an
	SGML validator, and may well not account for this subtlety.


-- 
--------------------------- DISCLAIMER ---------------------------------
Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be the views of BTS.

Received on Wednesday, 6 December 2000 14:30:12 UTC