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 "Ezberlin, Prakte12-08" <Pr...@t-systems.com> on 2003/01/23 12:51:33 UTC

use-Tags

Hello!

I use JSVGCanvas for simple editing of SVG elements.
I want to insert a new reference to an existing <symbol>-tag, but
the change is only reflected in the DOM and not on the canvas.
Other manipulations work fine that proof me that dynamic update works.

My idea of creating a new instance:

Element newUseTag=document.createElement("use");
newUseTag.setAttribute("xlink:href","#helper"+id.substring(1));
newUseTag.setAttribute("xlink:type","simple");
newUseTag.setAttribute("xlink:actuate","onLoad");
newUseTag.setAttribute("xlink:show","embed");
newUseTag.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");
newUseTag.setAttribute("transform","translate(10,150)");
document.getDocumentElement().appendChild(newUseTag);


I am trying to instantiate the xlink attribute in different way but that doesn't work until now.

Thank you for your help 
Uwe Knauer

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


Re: use-Tags

Posted by Vincent Hardy <vi...@sun.com>.
Hello Uwe,

SVG is 'namespace aware', so you should always use the xxxNS DOM method 
and stay away from the DOM Level 1 methods like createElement and 
setAttribute. Instead, you need to:

a. Use createElementNS(svgNS, svgElementName) for SVG content.

b. Use setElementNS(null, attributeName, attributeValue) for SVG 
attributes. e.g., rect.setAttributeNS(null, "width", "200");

b. Use setElementNS(ns, qualifiedName, value) for xlink attributes or 
any attribute in a namespace other than the per element partition 
namespace (nasty name for the attributes which do not have a namespace 
on an element). e.g., image.setAttributeNS(xlinkNS, "xlink:href", "#myRef"),

Vincent.

Ezberlin, Prakte12-08 wrote:
> Hello!
> 
> I use JSVGCanvas for simple editing of SVG elements.
> I want to insert a new reference to an existing <symbol>-tag, but
> the change is only reflected in the DOM and not on the canvas.
> Other manipulations work fine that proof me that dynamic update works.
> 
> My idea of creating a new instance:
> 
> Element newUseTag=document.createElement("use");
> newUseTag.setAttribute("xlink:href","#helper"+id.substring(1));
> newUseTag.setAttribute("xlink:type","simple");
> newUseTag.setAttribute("xlink:actuate","onLoad");
> newUseTag.setAttribute("xlink:show","embed");
> newUseTag.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");
> newUseTag.setAttribute("transform","translate(10,150)");
> document.getDocumentElement().appendChild(newUseTag);
> 
> 
> I am trying to instantiate the xlink attribute in different way but that doesn't work until now.
> 
> Thank you for your help 
> Uwe Knauer
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 



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