471,327 Members | 2,728 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,327 software developers and data experts.

Serialization Problem

Hi,

I am trying to use the following code to make xml serialization to a
file. The following error is being given:

"An unhandled exception of type 'System.InvalidOperationException'
occurred in system.xml.dll

Additional information: There was an error generating the XML
document."

The problem should be due to inheritance.

Can someone help me solve the problem out.
Thanks in Advance

ICommunicationTuple ict = new MessageQueueCommunication("test");
XmlSerializer ser = new XmlSerializer(typeof(ICommunicationTuple));
StreamWriter writer = new StreamWriter("c:\\test.xml");
ser.Serialize(writer, cu);
writer.Close();

public abstract class ICommunicationTuple
{
public ICommunicationTuple(){}
}

public class MessageQueueCommunication : ICommunicationTuple
{
private string msgQueuePath;

public MessageQueueCommunication(){}

public MessageQueueCommunication(string messageQueuePath)
{
MessageQueuePath = messageQueuePath;
}
public string MessageQueuePath
{
set { msgQueuePath = value;}
get { return msgQueuePath; }
}
}

Dec 3 '05 #1
1 1533
XmlSerializer ser = new XmlSerializer(typeof(ICommunicationTuple), new
Type[]{typeof(MessageQueueCommunication)});

--Peter

Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Curious" wrote:
Hi,

I am trying to use the following code to make xml serialization to a
file. The following error is being given:

"An unhandled exception of type 'System.InvalidOperationException'
occurred in system.xml.dll

Additional information: There was an error generating the XML
document."

The problem should be due to inheritance.

Can someone help me solve the problem out.
Thanks in Advance

ICommunicationTuple ict = new MessageQueueCommunication("test");
XmlSerializer ser = new XmlSerializer(typeof(ICommunicationTuple));
StreamWriter writer = new StreamWriter("c:\\test.xml");
ser.Serialize(writer, cu);
writer.Close();

public abstract class ICommunicationTuple
{
public ICommunicationTuple(){}
}

public class MessageQueueCommunication : ICommunicationTuple
{
private string msgQueuePath;

public MessageQueueCommunication(){}

public MessageQueueCommunication(string messageQueuePath)
{
MessageQueuePath = messageQueuePath;
}
public string MessageQueuePath
{
set { msgQueuePath = value;}
get { return msgQueuePath; }
}
}

Dec 3 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by David K | last post: by
37 posts views Thread by Ben | last post: by
reply views Thread by ktn | last post: by
1 post views Thread by andrewcw | last post: by
2 posts views Thread by Norman Chong | last post: by
4 posts views Thread by mijalko | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.