hi John,
   Could this message "Building an SVGDocument" maybe be relevant:
http://koala.ilog.fr/batik/mlists/batik-users/archives/msg00572.html
?
-Randy

 -----Original Message-----
From: Jones, John JH SITI-ITADED [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 03, 2004 5:56 PM
To: Batik Users
Subject: RE: Failure to generate XML after using SVGGraphics2D apparently OK.


Yinka,
Thanks for the suggestion. I'll wait 24 hours to see if anyone can spot a simple 
mistake and if I still have the problem I'll probably do as you suggest.

Actually there is one other thing that might hold me up. I am also using a class from 
'org.heml.image.text.WrappingSvgText'. I use it to draw right-justified fields rather 
than the usual left-justified fields. Are you aware of whether or not that is possible 
with the package you recommend? If not, are you aware of how to get the length of a 
rendered string so that you can calculate where the right hand end would end-up?

Thanks
-----Original Message-----
From: Yinka Martins [mailto:[EMAIL PROTECTED]
Sent: 03 May 2004 16:43
To: 'Batik Users'
Subject: AW: Failure to generate XML after using SVGGraphics2D apparently OK. 


Hey John,
 
That's just the problem i had too using batik. (actually it's one of the many problems 
I had). Though an experienced Java Developer, I could not tame the batik framework, 
spending a month trying to get it to do what I needed. My suggestion: there is another 
framework for Java / SVG out there. Its available at http://sis.cmis.csiro.au/svg . 
Although it's development was stopped 2002, it's just as complete as batik (some 
features are missing, but then there are others batik is lacking). The SVGToolkit, as 
it is called, is *** much *** less complex than batik. It took me a day to port all my 
batik code to SvgToolkit and get it running....
 
Give it a try, it worked fine for me ;-)
 
Greetz,
Yinka Martins.
 
-----Ursprüngliche Nachricht-----
Von: Jones, John JH SITI-ITADED [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 3. Mai 2004 16:44
An: [EMAIL PROTECTED]
Betreff: Failure to generate XML after using SVGGraphics2D apparently OK. 
 
Hi, 
I am using W2000 and Oracle Jdeveloper 9.0.3. I downloaded BATIK 1.5.1 on 17th April. 
I have 30+ years of software experience but am a beginner at JAVA and BATIK and 
mailing lists . This is my first graphics program. (I have read the BATIK FAQ but 
quite a lot of it has no meaning for me.)
The program appears to work when I do not attempt to generate the XML. i.e the frame 
displays what I am expecting. I am trying to capture the XML in order to view the 
diagram in a browser. I have followed http://xml.apache.org/batik/svggen.html .
When I try to generate the XML after displaying the output,  there are no exceptions 
raised or other messages but all I get is :
<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 
'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'> 
<svg style="stroke-dasharray:none; shape-rendering:auto; 
font-family:&apos;Arial&apos;; text-rendering:auto; fill-opacity:1; 
color-rendering:auto; color-interpolation:auto; font-size:12; fill:black; 
stroke:black; image-rendering:auto; stroke-miterlimit:10; stroke-linecap:square; 
stroke-linejoin:miter; font-style:normal; stroke-width:1; stroke-dashoffset:0; 
font-weight:normal; stroke-opacity:1;" xmlns="http://www.w3.org/2000/svg"; width="700" 
contentScriptType="text/ecmascript" preserveAspectRatio="xMidYMid meet" 
xmlns:xlink="http://www.w3.org/1999/xlink"; zoomAndPan="magnify" version="1.0" 
contentStyleType="text/css" height="700">
  <!--Generated by the Batik Graphics2D SVG Generator--> 
  <defs id="genericDefs" /> 
  <g /> 
</svg> 
Here are my imports and what I think to be the relevant bit of the main method: 
package helen; 
//import java.awt.Frame; 
import java.awt.event.WindowAdapter; 
import java.awt.event.WindowEvent; 
import javax.swing.UIManager; 
import javax.swing.JFrame; 
import java.awt.Dimension; 
import java.awt.Toolkit; 
import org.apache.batik.swing.*; 
import org.apache.batik.svggen.*; 
import org.apache.batik.dom.svg.SVGDOMImplementation; 
import org.w3c.dom.*; 
import org.w3c.dom.svg.*; 
import java.awt.geom.*; 
import java.awt.*; 
import java.io.*; 
      ................. 
// SVG set-up 
    DOMImplementation impl = SVGDOMImplementation.getDOMImplementation(); 
    String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; 
    SVGDocument doc = (SVGDocument)impl.createDocument(svgNS, "svg", null); 
    SVGGraphics2D g = new SVGGraphics2D(doc); 
    Diag d = new Diag(g, xlim, ylim, xorig, yorig, 3600); 
// Draw into g. For example: 
    d.buildDiag();        //Builds the internal representation of diagram 
    d.drawDiag();        //Uses SVGGraphics2D to draw the diagram 
    g.setSVGCanvasSize(dim); 
//  The following populates the document root with the 
//  generated SVG content. 
    Element root = doc.getDocumentElement(); 
    g.getRoot(root); 
// Now, display the document 
    JSVGCanvas canvas = new JSVGCanvas(); 
    frame.getContentPane().add(canvas); 
    canvas.setSVGDocument(doc); 
//  frame.pack(); 
    frame.setVisible(true); 
    
    System.out.println("Back from DrawDiag & display."); 
    try 
    { OutputStream outStream= new FileOutputStream("C:\\TEMP\\Helen_plasmid1.xml", 
false); 
      Writer out = new OutputStreamWriter(outStream, "UTF-8"); 
//      Writer out = new OutputStreamWriter(System.out, "UTF-8"); 
// 
      g.stream(out,true); 
      Thread.sleep(10000);   // In case something is being slow. 
      out.close(); 
    } catch (Exception e) 
    { System.out.println("Failed to write xml version."); 
    };  
    System.out.println("Back from xml gen."); 
  } 
          ........................ 
Any suggestions please? 
 John 

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

Reply via email to