Saving Global Settings of Layout in XML

Dear,

I am using GoXmlTransformer facility to save and retrieve the objects of a graph doc like Node and Link. and they are coming perfect.
Now i want to save some global setting for GoDocument itself and i want to do it using GoXmlTransformer not GoXmlBindingTransformer.
For this i have created DocXml class. code is blow.
public class GraphDocXml : GoXmlTransformer { public GraphDocXml() { this.TransformerType = typeof(GraphDoc); this.ElementName = "View"; } public override void GenerateAttributes(object obj) { base.GenerateAttributes(obj); GraphView gView = ((GraphDoc)obj).GetView;

WriteAttrVal(“BackColor”, gView.BackColor);
}
public override void ConsumeAttributes(Object obj)
{
base.ConsumeAttributes(obj);
GraphView gView = ((GraphDoc)obj).GetView;
gView.BackColor = ColorAttr(“BackColor”, gView.BackColor);
}
}

using this class i am trying to save GoView Background color. i have added the transformer as well. but when i Call the Generate of wrtitter it doesn’t invoke the generateAttiribute of DocXMl class.

private void OpenXml(Stream stream) { this.StartTransaction(); this.Clear(); GoXmlReader reader = new GoXmlReader(); reader.AddTransformer(new GraphDocXml()); reader.AddTransformer(new GraphNodeXml()); reader.AddTransformer(new GraphLinkXml());

reader.RootObject = this;
reader.Consume(stream);
this.FinishTransaction(“Loaded from file”);
}
private string SaveXml(Stream stream)
{
GoXmlWriter writer = new GoXmlWriter();
writer.RootElementName = “Layout”;
writer.AddTransformer(new GraphDocXml());
writer.AddTransformer(new GraphNodeXml());
writer.AddTransformer(new GraphLinkXml());

writer.Objects = this;
writer.Generate(stream);
return AppUtils.GetXmlText(stream);
}

it is urgent.

The GraphDoc is handled if there is a GoXmlBindingTransformer for it.

But, since you're using the lower level interface, the transformer you set up isn't used because the GraphDoc isn't a part of the Objects collection. So, you don't need the GraphDocXml transformer, just override GenerateRootAttributes:
protected override void GenerateRootAttributes() {
GraphDoc doc = this.Objects as GraphDoc;
if (doc != null) {
WriteAttrVal(“docname”, doc.Name);
WriteAttrVal(“lastpartid”, doc.LastPartID);
WriteAttrVal(“papercolor”, doc.PaperColor);
… etc …
}
}

and similarly for the override of ConsumeRootAttributes.