Arvind,

Your code keeps modifying the d attribute on the same path
element (created only once). The appendChild method first removes the
child from the tree if it is already in the tree, which is the case
in your example.

You'll need to create a new path element for each iteration of the
loop.

Vincent.

Arvind Sareen wrote:
> 
> Hi,
> 
> I am trying to create line at different points through Path command.
> But it is printing the line on the basis of last co-ordinates.
> I have placed the path command in the for loop.
> Please help because after this I have to append this svg file with another
> svg file having used the path command.
> 
> Below is my code:
> 
> 
>         svgRoot.appendChild(rectangle4);
> 
>         path1 = doc.createElementNS(svgNS, "path");
>         for(int i=10;i<100;i=i+10)
>         {
>                 for(int j=110;j<210;j=j+10)
>             {
>                   path1.setAttributeNS(null, "d", "M25 "+j+"L"+j+" 5");
>                   System.out.println("d,M20 "+j+"L"+j+" 5");
>   path1.setAttributeNS(null, "style", "fill:black;stroke-width:2000");
>                   svgRoot.appendChild(path1);
>             }
> 
>         }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to