Simple SVG Parser?

I guess I know the answer in beforehand, but I thought I would double check before frustrating completly g

What SVG Loaders targeting at the OpenVG API are currently around? I am aware that AlexVG implements the TinySVG standard, but for some reason I can not download the demo from their forums (not even after registering) and I have no idea about their licensing terms.

Then there is the svgconv tool, which I did not manage to compile. Others, even in this forum, seem to have similar trouble.

I am not asking for a complete SVG implementation, all I need are the very basic constructs. See the attachment.

The attachment can be rendered via AGGs SVG Test Sample. But AGG is not quite a possible solution to me, as i would like Hardware acceleration. Currently I tend to use the shivaVG implementation (if that matters).

Edit: Hmm, the attachment function does not seem to allow SVGs… Here ist the source of my SVG:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

     id="defs4" />
     d="M 24.656174,97.865133 L 25.22824,22.932957 C 25.486372,7.7008523 37.691293,2.2784149 50.113172,2.1354538 C 63.512353,1.971473 75.05983,11.844893 74.998102,23.238803 L 74.712067,97.865133 L 24.656174,97.865133 z"
     style="fill:#00ff00;fill-rule:evenodd;stroke:#000000;stroke-width:1.36647499px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
     d="M 24.921978,21.840945 C 15.608661,21.812246 15.840123,39.757915 24.993878,39.510016"
     style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.13771975px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
     d="M 24.247024,71.646433 C 14.933707,71.617733 15.165169,89.563402 24.318924,89.315503"
     style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.13771975px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
     d="M 74.642959,39.195771 C 83.954776,39.37676 83.980006,21.429405 74.823775,21.527592"
     style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.13771975px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
     d="M 74.922436,88.959699 C 84.234254,89.140689 84.259483,71.193332 75.103253,71.291519"
     style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.13771975px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />

Well, I don’t know of and good free ones either.

svgconv… I spent a day trying to install all the packages to get it to successfully compile (windows, vmware, cygwin, etc.). Finally I managed it in cygwin and using GODI (successful installation requires a) pure luck, and b) a system that has never seen any part of ocaml installed in either cygwin or windows [even uninstalling, it leaves a mess in your enviroment variables, preventing a successful re-install]).

More importantly than that though, is that IT’S NOT WORTH THE TROUBLE! Stay away from svgconv! It is hopelessly bad. I cannot stress this enough! For one thing, it only supports filled paths (no stroked paths). Anything else would require a large re-write of just about everything. Linear and Radial paints don’t work. rect and circle tags are not supported, neither are named colors, and in general it seems to spit out an error on every second line of a perfectly valid plain svg file (and forget about it if it has sodipodi tags), often producing a 0 byte file as it cannot handle any of the SVG inputs. Claiming it’s a beta, is an insult to all betas - version 1.0.5 is even more laughable.

If it’s just 1 simple SVG file like that, I highly recommend that you download the OpenVG reference implementation, and construct the data structures by hand in a way compatible with the rendering functions in the tiger example (basically hack up the tiger example). It should be the simplest method for such a small SVG file.

Sadly its not only that file :frowning: So I will be hacking up my own simple SVG parser. Lets see how far I can take it.

I’m in a similar predicament. I have an OpenVG rendering application that I am writing that can take in SVG, JPEG, self defined XML content, and MPEG files and render them with effects.

I chose the OpenVG approach because it seems very promising, but I fear It may be to far ahead of its time at the moment…

I fear I may have to write an SVG parser myself. Creating the data object that stores the content seems to me to be the easiest part though. If anyone has any advice on what parser they have used and what not to use, I would appreciate it.


I am afraid my solution is not as “flexible” as I planned it. It is tied closer to my application (and even involves the wxWidgets Colour class to easy colour parsing) then it probably should :frowning: But if you want to have a look how I did it (and what I did so far: , i agree that its not too much, but the system can easily be extended!) just drop me an email and I can mail you the relevant sourcecode.

This very basic implementation allows the parsing of SVGs of the following style: … _vista.png