Version 4, last updated by wycc at December 17, 2010 21:00 UTC

Inkscape 0.48 provide a dual tree model to represent the SVG in the memory. The Node is a direct DOM representation of the SVG document. However, the inkscape introduce another data struct SPObject which is the real object used in the inkscape. Initially, we duplicate the dual tree model in the python. However, the inkscpae team want to use the DOM for the script extension instead. Unfortunate, it is hard to estimate when this will happen.

In order to keep our work independent freom the development of the inkscape, we will define a DOM-like API in the python and then all of our extension will use this DOM interface only. In the future,. if the inkscape DOM is ready, we will switch to it by using the same interface.

 

The following method must be provided in the DOM API.

firstChild

DOM: getFirstChild()

 

lastFChild

DOM:getLastChild()

 

ChildList

DOM:getChildNodes()

 

appendChild(c)

DOM:appendChild(c)

 

removeChild(c)

DOM:remnoveChild(c)

 

attribute(name)

DOM: getAttributes().getNamedItem(name).value()

 

 

setAttribute(name,value)

DOM:setAttribute(name,value)

 

name()

DOM: nodeName()

 

getId()

DOM: getAttributes().getNamedItem("id").value()

 

 

label()

DOM"getAttributes.getNamedItem("inkscape:label").value()

 

 

The following is the API in the document class.

 

createElement(name)

DOM:document.createElement(name)

 

getNext()

DOM:nextSibling()