Module to read svg

Robert Kern robert.kern at gmail.com
Tue Jan 9 10:00:20 CET 2007


Tim Roberts wrote:
> Robert Kern <robert.kern at gmail.com> wrote:
> 
>> Martin v. Löwis wrote:
>>> schpok at gmail.com schrieb:
>>>> Does anyone know if there's an actual free implementation of this?
>>> For the dom module in it, xml.dom.minidom should work. Depending on
>>> your processing needs, that might be sufficient.
>> I don't think it quite fits what the OP is asking for. SVG defines some non-XML
>> structure for some of its contents. For example:
>>
>>  <polyline points="100,200 100,100" />
> 
> Why is that non-XML?

Oh, it's valid XML, certainly. However, the data inside the attribute is not
just a bunch of arbitrary characters; it needs to be parsed with a non-XML
parser to get the actual list of points. And unfortunately, "for
space-efficiency" the grammar that describes that data is full of tricks and
shortcuts to save a few characters here and there (actually, I think point lists
are fine; path definitions, though are nuts). See the SVG spec for the full EBNF
grammar.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list