2011/6/18 <joakim@...1974...>:
I naively assumed this would be trivial but when I dig in the code it doesn't seem like it is. In particular it is not immediately obvious how to convert between Inkscapes DOM model and libxml2:she model.
libxml2 is actually only used when loading the document, and we construct a different XML tree based on the one we get from libxml2. The relevant bit is in src/xml/repr-io.cpp:402. As far as I understand this is because our XML tree has support for change notifications and is garbage collected.
The simplest way I can think about now is a workaround involving loading the file with libxml2, and find the nodes in that tree instead.
Yes, you'll have to do this, unless you want to put a lot of effort into rewriting code in src/xml/.
Regards, Krzysztof