xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Making a SVGDocument from an SVG element contained in a file.
Date Fri, 01 Dec 2006 10:52:03 GMT
Hi Phil,

"Phil Wright" <phergus@gmail.com> wrote on 11/29/2006 07:57:57 PM:

> Say I have a file something like this:
> <somefile>
>    <svg width="6.5in" height="9in" contentStyleType="text/css"
>     [...]
> And I have read it in via an XML parser and have grabbed one of the SVG 
> How do I turn that grabbed element into a SVGDocument such that I can 
> give to a  canvas.setDocument() call?

   With all but the SVN version of Batik you need to use 'importNode'
to create nodes in a new document:

        batik.dom.svg.SVGDOMImplementation domImpl = new 
        SVGDocument doc = domImpl.createDocument(SVG_NS, "svg", null);
        doc.appendChild(doc.importNode(otherSVGElement, true));

> My first though was to create an empty SVGDocument and then use 
> adoptNode(thatelement)  based on something recently posted here but that 
> me a not particularly helpful error: 

   Adopt node is part of DOM Level 3, SVG 1.0/1.1 only used DOM Level 2.
The SVG version of Batik is adding support for DOM Level 3 methods.

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

View raw message