
bulia byak wrote:
And by the way this is pretty serious bug because it makes it impossible to use any Python effects on documents with text. Even though it's not our fault, but we need to think of a workaround. I just tried adding
xmlns:xml="http://www.w3.org/XML/1998/namespace"
to the root <svg> but this did not help at all (same error). And besides adding this declaration makes the document fail in Batik (even though it's still valid as far as I understand).
Just in case, here's the spec on namespaces: http://www.w3.org/TR/REC-xml-names/
I'm starting to think the failure with PyXML isn't because of the "xml:" prefix but rather because of the "xmlns:xml" declaration itself.
When I run a minimal svg:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- xmlns:xml="http://www.w3.org/XML/1998/namespace" --> <svg xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
</svg>
Through a minimal python script:
#!/usr/bin/env python import sys, xml.dom.ext.reader.Sax2 reader = xml.dom.ext.reader.Sax2.Reader(validate=0) stream = open(sys.argv[-1],'r') document = reader.fromStream(stream) stream.close()
I get the error when ever I include the 'xmlns:xml="http://www.w3.org/XML/1998/namespace"' declaration in the root.
The reason that I initially related the problem to the presence of the "xml:" prefix is that when Inkscape sees the prefix it adds the namespace declaration. And if there is no prefix found in the file the namespace declaration is ommited on save. So when I removed the prefix, Inkscape was sending a file without the xml namespace declared to the extensions, even though the namespace declaration was present in the original file I was looking at.
If that declaration chokes Batik too, should we make a point of omitting it all together?
Aaron Spike