It is quite easy to write the code that will load an SVG document into a Sugar hierarchy. Make sure your program has the following three elements:
Include the header files <sugar/ParseSvgToObject.h> and <sugar/SugarObjects.h>.
Instantiate a SugSvgDocument object.
Call parseSvgToObject(char*, *SugSvgDocument), where the first parameter is name of the file that contains the SVG document, and the 2nd parameter is the pointer to the SugSvgDocument you created previously.
After the call to parseSvgToObject the Sugar object hierarchy should hold the contents of the parsed file in memory. You should now be ready to use the Sugar object hierarchy to render the SVG document. Don't forget to clean up any memory you allocated in the creation of the SugSvgElement after you are done with it!
After the SVG document has been successfully loaded into the Sugar object hierarchy, you can now use the hierarchy to retrieve the data needed for rendering. The process is made very easy through the use of accessor functions in the basic Sugar Object primitives.
In order to travel through the hierarchy, use the traverse functions defined in SugNode. These functions allow you to move in any direction in the hierarchy from the current node: down to the children, up to the parent, right to the next sibling, or left to the previous sibling.
In order to retrieve attributes from each node, use the accessor functions defined by SugElement and the objects that derive from SugElement.
Rendering of the SVG document should be left up to the seperate rendering subsystems. The renders should use an in-order traversal of the object hierarchy to render the objects in the correct order.