I use Xindice to store some SVG Documents and retrieve them
as a org.w3c.dom.Document, which I now would like to show with 
JSVGCanvas.setSVGDocument(svgdocu)

I tried:

i)
Document doc = ..//obtained from Xindice. Printed it out when getting it form the DB 
and is a correct SVG (generated with Sodipodi).
SVGDocument svgDoc;
SVGDOMImplementation impl = (SVGDOMImplementation) 
SVGDOMImplementation.getDOMImplementation();
svgDoc = (SVGDocument) org.apache.batik.dom.util.DOMUtilities.deepCloneDocument(doc, 
impl); 
// svgDoc.createElementNS("?","?"); // needs to be set correctly? 

This doesn't work. It seems to me after this operation all the attributes of the svg 
tags are removed??!!
JSVGCanvas says: " The attribute 'width' of the element <rect> is required"
and the this way cloned document looks printed like this:

<?xml version="1.0" encoding="UTF-8"?>
<svg contentScriptType="text/ecmascript" zoomAndPan="magnify" 
contentStyleType="text/css" id="svg548" 
sodipodi:docname="/home/yoyo/yoyo/eth/7_sem/semesterarbeit_xml_db/batik/rect.svg" 
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"; version="1.0" 
width="210mm" preserveAspectRatio="xMidYMid meet" sodipodi:version="0.32" 
xmlns:xlink="http://www.w3.org/1999/xlink"; height="297mm" 
xmlns="http://www.w3.org/2000/svg"; xmlns="http://www.w3.org/2000/svg"; 
sodipodi:docbase="/home/yoyo/yoyo/eth/7_sem/semesterarbeit_xml_db/batik">
  <defs/>
  <sodipodi:namedview/>
  <rect/>  <---- wrong, was alright in the source Document
</svg>


ii)
DOMImplementation domImpl = SVGDOMImplementation.getDOMImplementation();
document = (SVGDocument)domImpl.createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI, 
"svg",null);
                
                        
DOMResult domResult = new DOMResult(document.getDocumentElement()); //give rootelement 
to domResult
DOMSource domSource = new DOMSource(node); // known node from the Document
//DOMSource domSource = new DOMSource(srcdoc.getElementsByTagName("svg").item(0));
                
// Use a Transformer for output
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.transform(domSource, domResult);

doesn't work either..?

iii)
Somebody wrote  the latest batik version JSVGCanvas contains a setDocument that 
accepts a normal DOM Document. I compiled 1.5 from 3.12.2003, didn't found the 
function?

After several hours of research....
I would be very,very glad if somebody may give me a hint or a little code-snippet that 
may help solving this basic problem.

Thanks a lot!

greetings

jonas





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to