Sujesh wrote
-------------
I am working on an application , which uses SVG extensively as icons as well as 
background images . We are planning to provide an option for mass editing of 
the icons.

Is there any way i can extract common elements ( circles,rects.. etc )  from 
svg document?
-----------------

I don't know where this application is likely to run, but within the svg 
document itself you can use javascript to do much of the work sort of as 
follows:

function multitag(O){
 var Shapes=new Array("rect","circle","path","ellipse")
 Shapelist=new Object
 for (i in Shapes){
  Shapelist[Shapes[i]]=O.getElementsByTagNameNS(xmlns,Shapes[i])
     for (j=0;j<Shapelist[Shapes[i]].length;j++){
   alert(Shapes[i]+" "+j+":"+Shapelist[Shapes[i]].item(j).nodeName)
  }
 }
 return Shapelist
}

The inner loop with the alerts is in there just to show step-by-step results.
Basically this function can be invoked with a call like Stuff=multitag(SVGRoot)
and then stuff will be an Object (sort of like an associative array), 
consisting of
a collection of nodeLists organized by and indexed by node type 
("rect","circle","path","ellipse").
It can be accessed just as it is in the inner loop.

Basically, the getElementsByTagNameNS method does all the work.

Such code works for me in IE/ASV, Opera 9 and FF1.5.

hope this makes sense,
David


[Non-text portions of this message have been removed]



-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to