Say I have a file something like this:

<somefile>
<svg width="6.5in" height="9in" contentStyleType="text/css"
    xmlns:xlink="http://www.w3.org/1999/xlink"; zoomAndPan="magnify"
    preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg";
    id="one" version="1.2">
   <g id="blocks">
       <rect x="42.0" y="35.0" fill="#c0c0c0" width="105.0" id="rect1"
             height="85.0" stroke="#000000" stroke-width="2"/>
   </g>
</svg>
<svg width="6.5in" height="9in" contentStyleType="text/css"
    xmlns:xlink="http://www.w3.org/1999/xlink"; zoomAndPan="magnify"
    preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg";
    id="two" version="1.2">
   <g id="blocks">
       <rect x="42.0" y="130.0" fill="#c0c0c0" width="105.0" id="rect1"
             height="85.0" stroke="#000000" stroke-width="2"/>
   </g>
</svg>
</somefile>

And I have read it in via an XML parser and have grabbed one of the SVG
elements.

How do I turn that grabbed element into a SVGDocument such that I can then
give to a  canvas.setDocument() call?

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

Exception in thread "main" java.lang.AbstractMethodError:
org.apache.batik.dom.svg.SVGOMDocument.adoptNode
(Lorg/w3c/dom/Node;)Lorg/w3c/dom/Node;

So what is the right way to do this?

     Phil


--
Visit http://www.darkisle.com for photos of castles, cairns and other
historic sites in the British Isles.

Reply via email to