[Mono-list] Xml Deserialize + Constructor Needed
Pablo Fischer
pablo@pablo.com.mx
Mon, 13 Oct 2003 23:58:22 -0500
Hi all!
I created a file in XML with the help of XmlSerialization, how I want to
Deserialize it, I found in may sites (also in msdn) a simple way to do
this, so my method:
private static void Desarmar() {
Accounts accs = new Accounts("test");
XmlSerialize mySerializer = new XmlSerializer(typeof(Accounts));
FileStream myFileStream = new FileStream(".mbloggyrc", FileMode.Open);
accs = (Accounts)mySerializer.Deserialize(myFileStream);
}
It compiles ok, but when I run it I get:
Unhandled Exception: System.MissingMethodException: Default constructor
not found
in <0x00144> System.Activator:CreateInstance (System.Type,bool)
in <0x00012> System.Activator:CreateInstance (System.Type)
in <0x001ab>
System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadClassInstance (System.Xml.Serialization.XmlTypeMapping,bool,bool)
in <0x00067>
System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadObject
(System.Xml.Serialization.XmlTypeMapping,bool,bool)
in <0x000a2>
System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadObject ()
in <0x00075> System.Xml.Serialization.XmlSerializer:Deserialize
(System.Xml.Serialization.XmlSerializationReader)
in <0x00068> System.Xml.Serialization.XmlSerializer:Deserialize
(System.Xml.XmlReader)
in <0x0003f> System.Xml.Serialization.XmlSerializer:Deserialize
(System.IO.Stream)
in <0x0009a> .testing:Desarmar ()
in <0x0012c> .testing:Main ()
A Default Constructor.. for what? I have a Constructor for each
element..
Thanks!
Pablo
--
Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
http://www.pablo.com.mx
http://www.debianmexico.org
GPG FingerTip: 3D49 4CB8 8951 F2CA 8131 AF7C D1B9 1FB9 6B11 810C
Firma URL: http://www.pablo.com.mx/firmagpg.txt