Re: Spec question: whitespace in attributes

Ian,
This is actually a tricky issue.

If you read the most recent SVG Recommendation 
(http://www.w3.org/TR/SVG11), then I could see how people could conclude 
that putting a space within an "x" attribute on a <rect> element would be 
an error. This conclusion would be based on the fact that the specification 
describes the grammar for a <length> by referring to the grammar for a 
<number> which is described in 
(http://www.w3.org/TR/SVG11/types.html#DataTypeNumber) as consisting of 
things such as digits and periods and does not mention the possibility of a 
space.

However, it seems to me that SVG should have been referencing XML Schema 
Datatypes (http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/) for the 
definition of primitive data types which overlap with  XML Schema 
Datatypes. For example, XML Schema Datatypes has a "decimal" primitive 
datatype which is an exact match for the SVG datatype, with the notable 
exception that XML Schema Datatypes seems to allow whitespace around 
primitive datatypes. (I'm not sure.)

So, I think this should be classified as an open issue and taken up by the 
SVG WG. For the time being, content creators are advised to not insert 
extraneous whitespace in their attribute values.

(One reason SVG has its own definitions is that there isn't an exact match 
between SVG's data types and XML Schema Datatypes. Also, the datatypes 
parts of the SVG spec were written long before XML Schema Datatypes became 
a Recommendation, and then the SVG WG didn't remember to update that part 
of the SVG spec.)

Jon

At 04:01 AM 9/30/2004, Ian Hickson wrote:


>Am I correct in assuming that leading and trailing whitespace in
>attributes in SVG should not be ignored and should in fact cause the
>document to be in error?
>
>e.g. Am I correct in saying that this test:
>
>    http://www.hixie.ch/tests/adhoc/svg/error/015.xml
>
>...should display a green rectangle and an "error" notification, not a red
>rectangle?
>
>Cheers,
>--
>Ian Hickson               U+1047E                )\._.,--....,'``.    fL
>http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
>Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 30 September 2004 20:57:57 UTC