-
Is it possible to add additional XML namespace definitions prior to writing out the shapes to XML? It's easy enough to add shapes with namespaces, e.g.
But the namespace definition is missing from the final output, which breaks things like my default image viewer. I see it's being hardcoded here, but maybe there's an opportunity to override elsewhere? https://github.com/cduck/drawSvg/blob/master/drawSvg/drawing.py#L124 I'm able to work around it by rewriting the XML with import xml.etree.ElementTree as ET
from lxml import etree
ET.register_namespace('inkscape', 'http://www.inkscape.org/namespaces/inkscape')
ET.register_namespace('', "http://www.w3.org/2000/svg")
parser = etree.XMLParser(recover=True)
tree = ET.parse('floorplan.svg', parser)
root = tree.getroot()
root.attrib['{http://www.inkscape.org/namespaces/inkscape}version'] = 'none'
tree.write('floorplan.svg') |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Custom namespaces are not currently supported but could be in the future. |
Beta Was this translation helpful? Give feedback.
Custom namespaces are not currently supported but could be in the future.