473,547 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML serialization problem

ktn
Hi all,

I'm a .NET beginner and I've got a problem on a program where I try to do an
XML serialization.
I get the following error :
"An unmanaged exception of type 'System.IO.File NotFoundExcepti on' occured in
mscorlib.dll
Additonal information : the file or asssembly named n9gu4-bo.dll or one of
its dependencies cannot be found"
Here is the code :
(I've uploaded the complete project at this url
http://netorld.free.fr/Interface2.zip)

public class Form1 : System.Windows. Forms.Form
{

....
....

public Form1()
{
InitializeCompo nent();

try
{
TextReader reader = new StreamReader("c onfig.xml");
XmlSerializer serializer = new XmlSerializer(t ypeof(Coef)); //the error
happens at this line
Coef lesCoefs = (Coef)serialize r.Deserialize(r eader);
reader.Close();

}
catch(XmlExcept ion xe)
{
MessageBox.Show (xe.Message, "XML Parse Error",
MessageBoxButto ns.OK, MessageBoxIcon. Error);
}

catch(InvalidOp erationExceptio n ioe)
{
MessageBox.Show (ioe.InnerExcep tion.Message, "XML Serialization Error",
MessageBoxButto ns.OK, MessageBoxIcon. Error);
}
}

}//End of class Form1


[System.Xml.Seri alization.XmlTy peAttribute(Nam espace="http://Interface2/Coef
")]
[System.Xml.Seri alization.XmlRo otAttribute(Nam espace="http://Interface2/Coef
", IsNullable=fals e)]
public class Coef
{

/// <remarks/>
[System.Xml.Seri alization.XmlAr rayAttribute("e preuve")]
[System.Xml.Seri alization.XmlAr rayItemAttribut e("jour",
typeof(CoefEpre uveJourHeure[]), IsNullable=fals e)]
[System.Xml.Seri alization.XmlAr rayItemAttribut e("heure",
typeof(CoefEpre uveJourHeure), NestingLevel=1)]
public CoefEpreuveJour Heure[][][] Items;
}

/// <remarks/>
[System.Xml.Seri alization.XmlTy peAttribute(Nam espace="http://Interface2/Coef
")]
public class CoefEpreuveJour Heure
{

/// <remarks/>
[System.Xml.Seri alization.XmlTe xtAttribute()]
public string Value;
}
Le xml file is structured like that :
<?xml version="1.0" encoding="utf-8" ?>
<Coef xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns="http://Interface2/Coef">
<epreuve>
<jour>
<heure>0</heure>
...
</jour>
....
</epreuve>
....
</Coef>
Thanks for your reading and maybe your answer,

Alain
Nov 12 '05 #1
0 1227

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

Similar topics

4
2096
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 ( see below), however when comparing the DataTable before and after the serialize, it is not the same The DataTable after the serialization contains...
37
4952
by: Ben | last post by:
Hi, there. Recently I was working on a problem where we want to save generic closures in a data structure (a vector). The closure should work for any data type and any method with pre-defined signature. When developing this lib, I figured that the pointer-to-member-function, although seemingly an attractive solution, does not work well...
1
4353
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 done this before but this time I have no idea why I am getting the error. Any ideas ?? THANKS ! <qcsttatus> <manual sourcerootfolder=""...
2
2343
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 a class that inherits from dataset, and I want to serialize it , so I created a serialization constructor that forwards the call to the base class...
0
2482
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 serializing the object but there seems to be a problem serializing an array of objects. Any help will be appreciated "Cannot assign object of type...
5
6010
by: Harold Howe | last post by:
I am having a problem deserializing objects from a library when the following conditions exist: 1- The library is strongly named 2- The serialized file was created with version 1.0 of the assembly 3- I am trying to deserialize from an EXE that references version 2.0 of the assembly 4- Both version 1.0 and 2.0 of the assembly reside in the...
2
1616
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 this. So I wrote the following code to serialize\deserialize the object, but now I have the problem that the object has a generic list and when I'm...
4
11388
by: mijalko | last post by:
Hi, I have inherited my class from System.Drawing.Printing.PrintDocument and I wish to serialize this object using XmlSerializer. And I get exception "There was an error reflecting type ...". If I look at innerException it says: "Cannot serialize member 'System.ComponentModel.Component.Site' of type 'System.ComponentModel.ISite'. OK it is...
2
5544
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 I am trying to read from a binary archive using Boost serialization. I am new to this, and it is possible that I have not understood the usage. In...
0
7435
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7698
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5361
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3472
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1922
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.