Hi,
I've a xml svg file and I would like to update it with Python.
First, I would like to fetch one dom node with getElementByID. I've one
issue about this method.
This is my example :
My SVG file :
"""
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg:svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons .org/ns#"
xmlns:rdf="http ://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http ://www.w3.org/2000/svg"
xmlns:xlink="ht tp://www.w3.org/1999/xlink"
xmlns:sodipodi= "http://sodipodi.source forge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape= "http://www.inkscape.or g/namespaces/inkscape"
width="210mm"
height="297mm"
id="svg2383"
sodipodi:versio n="0.32"
inkscape:versio n="0.46"
sodipodi:docnam e="product_page .svg"
inkscape:output _extension="org .inkscape.outpu t.svg.inkscape" >
</svg:svg>
"""
$ ipython
In [1]: from xml.dom import minidom
In [2]: dom1 = minidom.parse(" myfile.svg")
In [3]: print(dom1.getE lementById(u"sv g2383"))
None
In [4]: print(dom1.getE lementById("svg 2383"))
None
I don't understand why getElementById return always None.
Other example with libxml2dom library :
$ ipython
In [1]: import libxml2dom
In [2]: dom2 = libxml2dom.pars eFile("myfile.s vg")
In [3]: print(dom2.getE lementById(u"sv g2383"))
None
In [4]: print(dom2.getE lementById("svg 2383"))
I don't understand why getElementById return always None.
Well, my final purpose isn't to fetch root dom node but to fetch many
other sub node.
Thanks for your informations.
Stephane