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]