Persisting User Objects in XML

Hello All,
When a JGo document is persisted as XML, the User Object associated with that JGoObject is not stored in XML. For example, if we store JGoIconicNode in an XML, its associated user object is not stored. Is there any workaround/method for this??? Please share!!!

Yes, you just need to create a subsclass of the node class and override SVGReadObject() and SVGWriteObject() to deal with the UserObject. The following example assumes that UserObject is just a simple String, but of course you can change it to save and restore whatever data is in your UserObject.
public void SVGWriteObject(DomDoc svgDoc, DomElement jGoElementGroup)
// Add UserIconicNode element
DomElement jgoUserIconicNode = svgDoc.createJGoClassElement(“untitled16.UserIconicNode”, jGoElementGroup);
if ((this.getUserObject() != null) && (this.getUserObject() instanceof String)) {
// Save your UserObject data here, or call method on UserObject to do so.
String s = (String)getUserObject();
jgoUserIconicNode.setAttribute(“stringval”, s);
// Have superclass add to the JGoObject group
super.SVGWriteObject(svgDoc, jGoElementGroup);
public DomNode SVGReadObject(DomDoc svgDoc, JGoDocument jGoDoc, DomElement svgElement, DomElement jGoChildElement)
if (jGoChildElement != null) {
// This is a UserIconicNode element
// Read your UserObject data here, or call method on UserObject to do so.
super.SVGReadObject(svgDoc, jGoDoc, svgElement,
return svgElement.getNextSibling();

Hi Smith,
Thanks for your reply…That works!!!
Again , I have something to store at JGoDocument level or at JGoLayer level…The problem is these dont have a funda of User Objects… Is there any way for that?