Re: What to do about newlines in attribute values?

On 13/09/2012 13:33, Michael Sokolov wrote:
> If a MicroXML parser provides attribute values with newlines where an
>  XML parser provides attribute values with spaces instead, who will
> suffer?

well "suffer" is probably putting it strongly but anyone going

<td title="one
two
three">...</td>

will get a three line tooltip if parsed by microxml and a one line one
if parsed by XML.

The world can apparently survive such differences though as you get a
one line title in HTML4 (as specified) but a three line title in HTML4
(as implemented by browsers) and in HTML5 (as specified and implemented).

Other differences are things like

<xsl:if test=". = '
'">...

being true or false depending, but actually that seems less likely to me
as it's hard to imagine xslt being parsed as microxml.


As an example of what the "ban newlines" option means, the polyglot
(html/xhtml) spec bans newlines in attributes so that they parse the
same way in html and xml: this means that its example document

http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html#example-document

ends up with a 406 character line


<path transform="translate(60, -175)" d="M153 334 C153 334 151 334 151 
334 C151 339 153 344 156 344 C164 344 171 339 171 334 C171 322 164 314
156 314 C142 314 131 322 131 334 C131 350 142 364 156 364 C175 364 191
350 191 334 C191 311 175 294 156 294 C131 294 111 311 111 334 C111 361
131 384 156 384 C186 384 211 361 211 334 C211 300 186 274 156 274"
style="fill:white;stroke:red;stroke-width:2"/>

(of course it could be made a bit smaller by wrapping between the 
attributes.)

It would be very tempting for most human or electronic editors to wrap
that, and svg of course doesn't actually care about the parsing
difference since any white space between the tokens is OK. So the "ban
newlines" option puts a burden on authors for something that only makes
a difference in relatively rare edge cases.

David



________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Received on Thursday, 13 September 2012 13:43:27 UTC