How to get SVG document from eclipse JGo Document

I used JGO lib to create JGO Document in elcipse plugin.

How to get the SVG document from this generated Jgo Document.
I am using following code snippet::
Is this correct.
DefaultDocument dd = new DefaultDocument();
dd.buildSVGDoc(jDoc); //jDoc is JGoDocument object
Document doc = dd.getDocument();
From this code, i am unable to get complete JGoDocument which actually looks.
The above Code is working fine with JGo 1.3 version which i not used in eclipse. Now, JGo 5.1 version is compatable with eclipse plugin. So, I am using JGo 5.1 version. With this version (5.1) , I am unable to get SVG Document from actual JGoDocument.
Please can you help on this.
Thanks in Advance,

I’m not sure what you mean when you say that “the above code is working fine with JGo 1.3”. The DefaultDocument class and in fact the entire com.nwoods.jgo.svg package did not exist prior to JGo 4.1.

I also don't think you want to be calling the buildSVGDoc method directly. Typically, one generates an XML/SVG document with code similar to the following:
DefaultDocument svgDomDoc = new DefaultDocument();
svgDomDoc.WriteDoc(outs, jDoc);
Take a look at chapter 8 "JGo Support for XML and SVG" in the JGo User Guide for more details.

Sorry! the above code is working fine with JGo 4.1.

But, I am using JGo 5.1.
I need to get the Document Ojbect instead of writing the output. Please can you help on this.
Your original code looks like it should work, but I think it might be better to specify exactly what kind of elements you would like generated in the Document (GoDiagram XML and/or SVG). You might also want to reset the Document before populating it so that it's safe to perform the operation more than once.
DefaultDocument svgDomDoc = new DefaultDocument();
// Select what kind of XML elements to generate in the current Document
// Empty the current Document
// Recreate the Document from the JGoDocument
// Get the Document
Document doc = svgDomDoc.getDocument();

Generated SVG in Document object contains with <jgoxml:JGoClass and <ellipse elements which are not qualified in SVG viewer like Batik SVG Viewer and Adobe SVG Viewer.
Please can you suggest, how to replace this elements in new SVG Document Object. Present, I am removing these elements to show in Adobe SVG Viewer/Batik SVG Viewer. With this change, I am getting different svg which is not original.
Some times, I used to get group of nodes which the group identifies with boundary box. If i am using this type of SWING jgo view , i am not able to get the actual SVG.
Please can you help on this.

If the GenerateJGoXML property of DefaultDocument is set to “true”, JGo will generate JGoClass elements that are not part of SVG. These elements allow the generated XML to be read back in to JGo to recreate the original JGoDocument. If you are not reading the generated XML back into JGo, you do not need to generate these elements. Just set GenerateJGoXML to false.

The SVG ellipse elements generated should be fine, but if you need to change the SVG ellipse elements that are being generated for any reason, you can change the code in JGoEllipse.SVGWriteObject and/or JGoEllipse.SVGWriteAttributes.

How to use ImageObserver with JGo packages.

Previous versions, I used class which extends JGoImage. (say.. MyImage extends JGoImage)
ImageObserver observer = new MyImage(); //its works with 4.1 version to get the height and width, etc.
But, with 5.1 version, I am unable to use
ImageObserver observer = new MyImage();
at present, I am using JLabel();
Please can you suggest, which class is better to use in this case?

You should be able to use ImageObserver with JGo 5.1. What problem are you having? Did you perhaps change from using JGo Swing to JGo SWT? In JGo Swing, JGoImage is an ImageObserver. In JGo SWT, JGoImage is an ImageLoaderListener.

In any case, it's probably easier to just use JGoImage.getNaturalSize to get the natural unstretched dimensions of the image.