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 Strapz <st...@tiscali.it> on 2005/03/10 15:00:33 UTC

Import group nodes from other files

Hi all, I have a question;
If I have 2 SVG file, first.svg and second.svg, how can I import on
second.svg a group node of first.svg working with Documents at runtime,
make attention to style sheets?

Is it possible? Thanks


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


Re: Import group nodes from other files

Posted by Andres Toussaint <an...@onemileup.com>.
Use Document2.importNode(GroupNodeFromSVG1, true), to clone the first 
document
'under' the new document.  Then just append the result where you
want it in the parent document.

In regards to stylesheets, it is your responsibility to make sure that 
both documents share a compatible sheet. If you are certain that both 
documents do not have colliding stylesheets and do not share any style 
class names, you may import the style element from the second SVG to 
the first before you import the node. The style element is represented 
in the DOM by a SVGStyleElement and you can get to it by doing a 
svgDoc.getElementByTagName("style") [Note: i have not tested that this 
actually works]

Andres T.

On Mar 10, 2005, at 9:00 AM, Strapz wrote:

> Hi all, I have a question;
> If I have 2 SVG file, first.svg and second.svg, how can I import on
> second.svg a group node of first.svg working with Documents at runtime,
> make attention to style sheets?
>
> Is it possible? Thanks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>