473,385 Members | 1,397 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Problem with Xml Serialization

Jax
I have a rather large class that i'm looking to serialize
to Xml.
Whenever it tries to serialize it I get this error message:

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

Additional information: There was an error
reflecting 'VestaQuoteV1.Case'.

As it's a little vague i'm having difficulty in detecting
what it is that is causing this problem.
There are arraylists involved within the class although
each of these are prefixed with the:

[XmlElement(Type = typeof(Customer))]

element. Thereby getting rid of any problems with
serializing the weakly typed collections.

I've also tried using a SOAP formatter:

Case c = new Case();
FileStream myStream = File.Create("case.xml");
SoapFormatter myXMLFormat = new SoapFormatter();
myXMLFormat.Serialize(myStream, c);
myStream.Close();

But that just produces an xml file of a size of 0 bytes.

My original code for serialization is this:

Case c = new Case();
string path = @"c:\VestaQuote\case.xml";
TextWriter tr = new StreamWriter(path);
XmlSerializer sr = new XmlSerializer(typeof(Case));
sr.Serialize(tr,c);
tr.Close();

Can anyone give me pointers so i can tell what to look out
for while analyzing my class, or know of this problem and
know of any ways around it.
As always, I am sincerely grateful for any assistance.

Jax

Nov 15 '05 #1
1 1566
Jax
I should post better examples, my class actually went:

Case c = new Case("Ref");

The constructor needing a string, i added an empty
constructor and it worked fine.
-----Original Message-----
I have a rather large class that i'm looking to serialize
to Xml.
Whenever it tries to serialize it I get this error message:
An unhandled exception of
type 'System.InvalidOperationException' occurred in
system.xml.dll

Additional information: There was an error
reflecting 'VestaQuoteV1.Case'.

As it's a little vague i'm having difficulty in detecting
what it is that is causing this problem.
There are arraylists involved within the class although
each of these are prefixed with the:

[XmlElement(Type = typeof(Customer))]

element. Thereby getting rid of any problems with
serializing the weakly typed collections.

I've also tried using a SOAP formatter:

Case c = new Case();
FileStream myStream = File.Create("case.xml");
SoapFormatter myXMLFormat = new SoapFormatter();
myXMLFormat.Serialize(myStream, c);
myStream.Close();

But that just produces an xml file of a size of 0 bytes.

My original code for serialization is this:

Case c = new Case();
string path = @"c:\VestaQuote\case.xml";
TextWriter tr = new StreamWriter(path);
XmlSerializer sr = new XmlSerializer(typeof(Case));
sr.Serialize(tr,c);
tr.Close();

Can anyone give me pointers so i can tell what to look outfor while analyzing my class, or know of this problem and
know of any ways around it.
As always, I am sincerely grateful for any assistance.

Jax

.

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David K | last post by:
we are having a problem when trying to serilalize and deserialize DataTable When replacing the container to be ListArray or HashTable everything works fine The code is very straight forward (...
1
by: andrewcw | last post by:
There is an error in XML document (1, 2). I used XML spy to create the XML and XSD. When I asked to have the XML validated it said it was OK. I used the .net SDK to generate the class. I have...
4
by: james | last post by:
I upgraded my 2002 project to 2003 and I am getting several of there errors on my forms xxxForm.resx Resource transformation for file 'xxxForm.resx' failed. Possible Version mismatch. Type...
2
by: ofer | last post by:
Hi, I am working with the beta version of the new .net framework (Whidbey) and I encountered a problem with serialization that did'nt exist in the .net 2003 the situation is like this : I have...
0
by: umhlali | last post by:
I get the following exception when my VB.NET app calls a Java web service that returns an array of objects. The same call works for a single object though. So looks like there is no problem...
0
by: ZippyV | last post by:
Hello everybody, I'm trying to convert a given xsd scheme to vb.net code with the help of xsd.exe. I've had no problems during conversion but the problem is that I can't build the code in vs.net....
2
by: yqlu | last post by:
I hava developed a client in C# that is connected to a 3-party XML Web Services developed in Java based on the AXIS 1.1. Most methods call are successful except for one method named "findObjects"...
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
2
by: Norman Chong | last post by:
Hiddeldi ho, I want to save an object so that I can use its content after I restart my program. I tried to solve this with serialization because someone told me that this is the correct way for...
2
by: mkvenkit.vc | last post by:
Hello, I hope this is the right place to post a question on Boost. If not, please let me know where I can post this message and I will do so. I am having a strange problem with std::string as...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.