Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Save to XML (Read 2247 times)
educosta
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 14
Joined: Nov 5th, 2009
Save to XML
Nov 6th, 2009 at 1:29pm
Print Post  
Hi,

I tried use SaveToXml in example tutorial 3 but i get a error:

the given key...

What is?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Save to XML
Reply #1 - Nov 6th, 2009 at 1:58pm
Print Post  
Hi,

Add this to the MainPage constructor:
Diagram.RegisterItemClass(typeof(OrgChartNode), "my:OrgChartNode", 1);

You might also have to override the SaveToXml and LoadFromXml methods in the custom node type if there are any additional attributes you need to serialize.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Save to XML
Reply #2 - Nov 6th, 2009 at 4:29pm
Print Post  
It should look like this:

Code
Select All
protected override void SaveToXml(System.Xml.Linq.XElement xmlElement, XmlPersistContext context)
{
	base.SaveToXml(xmlElement, context);
	context.WriteString(Title, "Title", xmlElement);
	context.WriteString(FullName, "FullName", xmlElement);
}

protected override void LoadFromXml(System.Xml.Linq.XElement xmlElement, XmlPersistContext context)
{
	base.LoadFromXml(xmlElement, context);
	Title = context.ReadString("Title", xmlElement);
	FullName = context.ReadString("FullName", xmlElement);
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint