Re: Why the SVG DOM is so complex to use?

At 07:10 PM 8/31/00 +0200, Thierry Kormann wrote:
> > The main reason for the having attributes in the DOM such as 'width' and
> > 'height' are so that you can have object-oriented access to the values,
> > rather than just as strings. Yes, in many cases, string access is
> > sufficient, but in other cases, there is a lot of value in object-oriented
> > access. For example, with an SVGLength, you can determine what unit type
> > was applied without having to write a parser.
>
>Do you mean "without parsing the string" ?
>
>I'm asking this because a conforming viewer should also support 
>setAttribute so
>in any case the viewer must have a parser for CSS units, path, transform...

I didn't express myself clearly. I was referring to a script asking what 
the current value is for 'width' (for instance), and getting "10cm" as the 
response. In order to process the string "10cm", the script would have to 
parse this string to determine what units are provided.

This need for parsing can get quite complex in some circumstances. For 
example, the 'fill' and 'stroke' properties allow for a wide variety of 
values. You can say #abc, #aabbcc, rgb(a,b,c), url(zzz), url(zzz) #abc, 
url(zzz) #abc icc-color(r,s,v,t). It would be quite hairy for script 
writers who want to check the current 'fill' value if all they can get back 
is string values.

While I agree that most script writers don't need to get object-oriented 
access to values (I believe script writers tend to 'set' much more often 
than they 'get'), still we need to a complete and consistent job with the 
DOM. The two options are: (a) get rid of the SVG DOM entirely and only have 
the XML DOM, or (b) provide a complete and consistent SVG DOM. The working 
group decided long ago to do (b).

Jon Ferraiolo
SVG Editor
Adobe Systems Incorporated


>You can also imagine to use object-oriented access to set a value but use the
>getAttribute method to get the value. In that case, the viewer should 
>create a
>String using the SVGLength.
>
>
>Thierry.
>
>--
>Thierry Kormann
>email: Thierry.Kormann@sophia.inria.fr  http://www.inria.fr/koala/tkormann/
>Koala/Dyade/Bull @ INRIA - Sophia Antipolis
>
>
>
>

Received on Thursday, 31 August 2000 14:32:08 UTC