472,096 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,096 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 1155

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
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
reply views Thread by leo001 | 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.