![](https://secure.gravatar.com/avatar/15f5e6abf26f57e1838c29a8356ce7f8.jpg?s=120&d=mm&r=g)
Jasper van de Gronde <th.v.d.gronde@...528...> writes:
On 2011-06-18 10:31, joakim@...1974... wrote:
I would like to be able to select nodes using XPath: https://bugs.launchpad.net/inkscape/+bug/798640%3E 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.
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.
I can't be the only one wanting to do things like this. I'm obviously missing something, right?
Actually I don't think you are missing something. As far as I know Inkscape has no xpath-like functionality (frankly it's not needed that often). It would be extremely cool to have though, also in the find dialog! You shouldn't need to load the SVG separately though, Inkscape's internal representation more or less mirrors the XML. Besides, I don't think you'd really want to operate on the XML representation, as then you get weird things like having to check for a fill in two places (either as part of the style or as a stand-alone attribute).
I don't get this part?
BTW, I'm assuming that you would be writing your own XPath processing code (perhaps not necessarily the parser, but at least the part that finds the required nodes). If you meant to reuse an existing library you can probably forget about it (unless it's set up in an extremely flexible manner).
Well, I was thinking of using the xpath implementation in libxml2 since that is linked already. And I was trying to do that in the dbus extension as an option, so it wouldn't be linked if it wasnt possible.
If the libxml DOM interface could be implemented on top of the Inkscape XML api that would work but I don't know how difficult that would be.
Also writing an xpath processor is to much work for my use-case. It would be easier to achieve by scripting or by an extension or something.
EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev