Re: [widgets] Trimming attribute values, a bad idea?

On 3.12.2008 4.51, "ext Marcos Caceres" <marcosscaceres@gmail.com> wrote:
> Got a question... I've relaxed keyword attributes to be allowed to
> have leading and trailing whitespace. Now, widget user agents are
> required to trim whitespace prior to validation/processing. Widget
> user agents must only perform literal comparisons with trimmed values,
> and must not perform case insensitive comparisons.
> 
> So, for instance, <access network="     false    "> is ok.
> 
> Does anyone see any problem with this? Should I revert back to being
> strict and having UA do comparisons without trimming?

In the context of XML, I guess that instead of 'trimming' a slightly more
accurate term/concept would be 'attribute value normalization' [1], which
also includes compressing runs of white space into one. An interesting
discussion appears in 'Processing XML with Java' [2]. Based on that, it
might be better to just *not* do it, but then you wouldn't be XML compliant.
(So you could say that if an implementation doesn't, then it isn't.)

Note that in XML this is specified in terms of DTD datatypes, but the config
document is described in RELAX NG. It might not make a difference; maybe [3]
gives a better idea about how this pans out in practice.

[1] http://www.w3.org/TR/REC-xml/#AVNormalize
[2] http://www.cafeconleche.org/books/xmljava/chapters/ch01s02.html#d0e951
[3] http://books.xmlschemata.org/relaxng/relax-CHP-7-SECT-4.html

--Jere

Received on Wednesday, 3 December 2008 08:39:03 UTC