Also, Here is a HOWTO which uses an offscreen renderer to repeatedly render a dynamic SVG doc.
This approach is a little cleaner than running the doc thru the transcoder after every change. http://wiki.apache.org/xmlgraphics-batik/DynamicSvgOffscreen -----Original Message----- From: Declan Shanaghy [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 07, 2008 2:01 PM To: [email protected] Subject: RE: Transcode / clone part of an SVG document You need to call document.importNode(otherElement, true); In this way the element is cloned and becomes owned by the new document. However you still need to call node.appendChild for the previously imported node to become part of the DOM. Another approach would be to use a single document and hide the elements you do not wish to render. Either by setting the visibility attr or the display attr. -----Original Message----- From: Gerrit . [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 07, 2008 1:50 PM To: [email protected] Subject: Transcode / clone part of an SVG document Hi, I am trying to use the package org.apache.batik.transcoder.image to generate images of only parts of an SVG document (specific elements and their sub-trees). These images will then be used for Eclipse GEF/GMF figures. I haven't found any TranscoderInput that takes an Element or a GraphicsNode as an input, so I'm currently trying to clone Elements, and then insert them into a new SVG document. However, this doesn't seem possible as I get error messages that the cloned element is from the wrong document. Apparently, the clone that is created with cloneNode inherits the owner document from the original element. adoptNode is not implemented in SVGOMDocument, and importNode seems to have no effect. What's the right way to clone an SVG element and attach it to another document then? Are there maybe better ways to transcode parts of a document? Any input would be much appreciated. Thanks in advance, Gerrit Element clone = (Element) elementFromDoc1.cloneNode( true ); // doc2.adoptNode( clone ); // doc2.importNode( clone, true ); doc2.getDocumentElement().appendChild( clone ); org.w3c.dom.DOMException: node.from.wrong.document at org.apache.batik.dom.AbstractNode.createDOMException at org.apache.batik.dom.AbstractParentNode.checkAndRemove at org.apache.batik.dom.AbstractParentNode.appendChild _________________________________________________________________ News, entertainment and everything you care about at Live.com. Get it now! http://www.live.com/getstarted.aspx --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
