xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Problems adding text dynamically
Date Mon, 09 Jan 2006 15:54:18 GMT
Hi Maria,

   The problem is that you shouldn't use the SVG namespace for the
attributes on your text element.

Maria Carolina Arce Terceros <caroarce@gmail.com> wrote on 01/09/2006 
10:42:51 AM:

>                                 String      nSvg = 
SVGDOMImplementation.SVG_NAMESPACE_URI;
>                                 SVGDocument doc = 
svgCanvas.getSVGDocument();
>                                 Element text = doc.createElementNS(nSvg, 
"text");

   You are ok up to here.

>                                 text.setAttributeNS(nSvg, "font-size", 
"15");
>                                 text.setAttributeNS(nSvg, "fill", 
"black");
>                                 text.setAttributeNS(nSvg, "x", "200");
>                                 text.setAttributeNS(nSvg, "y", "200");

   These should all be: text.setAttributeNS(null, <blah>, <blah>)
   Just like you do for your rect:

> rect.setAttributeNS(null, "x", "100");

   The only place you need to provide a namespace is for the 
'xlink:href' attribute on images (where you need to use the
xlink namespace).

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


Mime
View raw message