If it helps, here is a Java method that adds a <desc> tooltip to any element.
Seems to work.
public void setDescTooltip( SVGOMDocument doc, Element element, String
desc_text )
{
// remove the old <desc> tooltip, if any
NodeList nodelist = element.getElementsByTagNameNS(
SVGDOMImplementation.SVG_NAMESPACE_URI, "desc" );
for (int i = 0; i < nodelist.getLength(); i++)
element.removeChild( nodelist.item( i ) );
// now add the new <desc> tooltip, if any
if (desc_text != null) {
// create a <desc> element and its text node which contains the tip text.
Element desc_element = doc.createElementNS(
SVGDOMImplementation.SVG_NAMESPACE_URI, "desc" );
Text text_node = doc.createTextNode( desc_text );
desc_element.appendChild( text_node );
// append the tooltip <desc> to the ID'd element
element.appendChild( desc_element );
}
}
Enjoy.
Cheers,
Eric
"MECHOULAM, Mickael" wrote:
> Hi,
>
> Thank you for your answer. However it seems to me the text in these <title>
> and <desc> tooltips cannot be formatted (new lines, colors etc...) so I
> suppose I must use scripting.
> Furthermore I still do not know how to insert the text of these tooltips in
> the SVG file : I suppose I will have to write a specific method for each
> figure that generates the SVG code and adds to it the text of the tooltips ?
>
> Mikael Mechoulam
>
> > -----Original Message-----
> > From: Thomas E Deweese [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, April 23, 2002 5:09 PM
> > To: Batik Users
> > Subject: Add user info to SVG shapes
> >
> >
> >
> > Hi Mickael,
> >
> > You might try using the <title> and <desc> elements. If present
> > Batik will automatically show tooltips when the mouse hovers over the
> > associated graphics element.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]