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 JJ Rock <jj...@yahoo.com> on 2005/11/18 13:50:35 UTC

Multiple SVG Files

Hi All,
  
  Does anybody have a good idea on how to insert multiple SVG files and  basically "merge" them onto one JSVGCanvas?  Basically this is a  drag and drop type operation, where you are taking various objects  contained in separate SVG files and putting them together.
  
  I was thinking about adding a group to the SVGDocument contained within  the canvas and then iteratively adding each element from the other  file(s) into that group.
  
  Will this work?  Is there a better way?
  
  Thanks,
  JJ
  

		
---------------------------------
 Yahoo! FareChase - Search multiple travel sites in one click.  

Re: Multiple SVG Files

Posted by th...@kodak.com.
Hi JJ,

JJ Rock <jj...@yahoo.com> wrote on 11/18/2005 07:50:35 AM:

> Does anybody have a good idea on how to insert multiple SVG files and 
> basically "merge" them onto one JSVGCanvas?  Basically this is a drag 
and drop
> type operation, where you are taking various objects contained in 
separate SVG
> files and putting them together.

   You might want to look at the 'use' or 'image' elements.  I'm not sure
if it is important that the referenced content actually become part of the
host document or not.

> I was thinking about adding a group to the SVGDocument contained within 
the 
> canvas and then iteratively adding each element from the other file(s) 
into that group.
> 
> Will this work?

   This should work, you might want to look at 'Document.importNode' which 
would
let you import and entire subtree in one call, then you could append the 
imported
subtree with one 'addChild' call.

>   Is there a better way?

   If you can I would recommend using 'use' or 'image'.  Even if you need 
the
end document to be 'stand alone' I would lean towards cloning the 
referenced
content and adding it to a 'defs' element and referencing the local copy
from a 'use' element (especially if they may have multiple instances of
the content in the composite document).


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