Jon Cruz <jon@...18...> writes:
On Jun 18, 2011, at 11:57 AM, joakim@...1974... wrote:
Jasper van de Gronde <th.v.d.gronde@...528...> writes:
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.
If you are interested in pursing this from a user/tester viewpoint, this is exactly something that has been targeted for a revised extensions API. The best route would be to expose a live DOM to extensions instead of the current "read-from-stdin, process, write-to-stdout" approach. Having someone with a need and willing to give feedback is the best way to help me or others actually write the code.
It also matches a need I have for adding dynamic validation and feature subset warnings (e.g. warn that you are using an unsupported SVG feature when doing a work that targets SVG Tiny). That would involve a simple pair of an XPath expression to find the SVG nodes to test followed by a simple true/false XPath expression to test each found node with.
For the implementation side of things, it might be possible to hook up to libxml2, or it might be quite difficult. The good news is that if a re-write for Inkscape is needed, then I should be able to knock that out without too much difficulty. In the past I've built both DOM and XPath libraries from scratch for hand-held blackberry applications. Especially since we're talking just selecting items, not full xslt, it is a much more manageable problem.
I would clearly like to help out with this. It would be vey useful for my use-cases. Your plan also seems much more fleshed out than mine.
BTW my immediate need, which is importing a svg file via dbus and modifying the result slightly, seems to be solvable by using the new dbus important function and the dbus tree traversal functions to find the apropriate child nodes to change.