Re: What to do about newlines in attribute values?

On 13/09/2012 07:29, James Clark wrote:
> On Thu, Sep 13, 2012 at 12:07 PM, Liam R E Quin <liam@w3.org
> <mailto:liam@w3.org>> wrote:
>
>
> It might be better to forbid newlines in attributes.
>
>
> That's an interesting suggestion. Every option has its problems:
>
> a) allow newlines but normalizes to spaces (as XML): compatible with
> XML, but leaves MicroXML with ugly and surprising
>
> b) disallow literal newlines: compatible with XML; users can still
> include newlines using numeric character references; possibly better
> error recovering when a closing quote is missing; maybe a surprising
> limitation, but then again lots of programming languages don't allow
> literal newlines in string literals
>
> c) allow newlines but don't normalize them: most useful behaviour
> but incompatible with XML
>
> Currently the spec has (c), but I can see definite advantages to
> (b).
>
> Opinions?

I don't like (c) as I think losing compatibility with xml is too high a
price to pay.

I was almost persuaded by the discussion to say to go for (b) but I
think Michael is correct that there are lots of places with long
attribute values (svg paths, xpath expressions some namespaceless
version of xsi:schemaLocation, ...) where editing the file in a way that
never inserts a literal newline would be a pain.

So I say (c). It is not actually "don't normalize" as all
newlines/carriage returns in the document are normalized.
It is just that #10, #13 and #10#13 pairs are normalized to a single #10
in element content and #32 in attribute values. That isn't ___so__ bad.
(Well it means the linespace normalization and tag parsing interact,
rather than the linespace normalization being a conceptual first pass,
but still...


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 11:11:58 UTC