So they seem more like a plug-in to vi for appearance than
an actual object editor.
I tried the python libraries. They have read-in
alternatives of DOM and SAX. After that, they seem a bit
basic. They seem to expect you to know the schema, or know
which to choose from the various schemas.
I was expecting a bit more. Maybe I'm foolish, but I'd
hoped to be able to:
- read into a DOM structure
- print out the schema - a node tree - of something as
common as a .svg file
- do a search and replace on tags or objects
Something like: %s/<text>\(.*\)</text>/<a
href:\1>&</a>/
But with some knowledge of the tags - the above is simply
sed syntax.
I'm getting the strong feeling that where I started, with
awk, might be the least inelegant place.
Unless, as is quite possible, I'm missing something
fundamental.
When I use the python DOM, the underlying assumption seems
to be that it's a fairly balanced and uniform tree, with a
single root. An SVG file, though, has a preamble, then a whole
series of nodes, at the same level as the preamble, so it's a
much flatter structure. So looking for sub-nodes of the root
and their siblings doesn't really work - well, it might, if
there was a way to print out what it thinks the structure is
to get an idea of the best way to navigate it.
The examples I've found make sense, but they're all based
on much simpler and more regular structures than an svg file.
Inkscape offers some nice looking reflections and
transformations of the diagram, but doesn't really seem
helpful when it comes to attaching URLs or other actions in
the CLI. Again, maybe I'm missing an obvious trick.
If I am missing some obvious tricks here, I'd be most
grateful if somebody could point them out to me - or point me
in the direction of something that addresses this.