You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by re...@st.com on 2003/06/10 14:55:47 UTC

how to add javascript to svg file

     Hello,
     
     I used api java to generate svg from chart components and I get svg 
     file corresponding. 
     Now I would like to add javascript from the svg file generated, by 
     using batik project api, but I don't know the procedure to follow and 
     which class to use. 
     May you help me and have you got any examples to show me how to 
     manipulate svg comportment with batik api?
     
     Best Regards 
     
     Renaud Dol


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


RE: how to add javascript to svg file

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "RD" == renaud dol <re...@st.com> writes:

RD> I used api java to generate svg from chart components and I get
RD> svg file corresponding.  

    Are you using the svggen.SVGGraphics classes to get the SVG
document?

RD> Now I would like to add javascript from the svg file generated, by
RD> using batik project api, but I don't know the procedure to follow
RD> and which class to use.  May you help me and have you got any
RD> examples to show me how to manipulate svg comportment with batik
RD> api?

    If you are using the svggen package, you can get the document as a
DOM tree.  The DOM provides methods to add new elements to the
document.  You probably want to add a script element with a CData
child node that contains the java script.

    You can also retrieve nodes from the Document using methods like
'SVGDocument.getElementById(String)' and add script attributes like
'onload', 'onclick' etc.

    There are lots of examples of using the DOM interface on the Net,
and if you search the archives of this mail-list you should see
several examples of how to get the DOM tree from the SVGGraphics, so
you can modify it and then write it out.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org