473,320 Members | 1,883 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,320 software developers and data experts.

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.FileNotFoundException' 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()
{
InitializeComponent();

try
{
TextReader reader = new StreamReader("config.xml");
XmlSerializer serializer = new XmlSerializer(typeof(Coef)); //the error
happens at this line
Coef lesCoefs = (Coef)serializer.Deserialize(reader);
reader.Close();

}
catch(XmlException xe)
{
MessageBox.Show (xe.Message, "XML Parse Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}

catch(InvalidOperationException ioe)
{
MessageBox.Show (ioe.InnerException.Message, "XML Serialization Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

}//End of class Form1


[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://Interface2/Coef
")]
[System.Xml.Serialization.XmlRootAttribute(Namespac e="http://Interface2/Coef
", IsNullable=false)]
public class Coef
{

/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute("epreuv e")]
[System.Xml.Serialization.XmlArrayItemAttribute("jo ur",
typeof(CoefEpreuveJourHeure[]), IsNullable=false)]
[System.Xml.Serialization.XmlArrayItemAttribute("he ure",
typeof(CoefEpreuveJourHeure), NestingLevel=1)]
public CoefEpreuveJourHeure[][][] Items;
}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://Interface2/Coef
")]
public class CoefEpreuveJourHeure
{

/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
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 1205

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 (...
37
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...
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...
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...
5
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...
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...
4
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.