G
George Ter-Saakov
I have a folowing code for XML serialization of the class. For some reason
XML is written only with the root element "AddRequestForQoute" and no
attributes like revision or lang.
What am i missing.
----------------------class ------------------------------
[XmlRootAttribute("AddRequestForQoute", Namespace="http://www.test.com")]
public class clsAddRequestForQoute
{
[XmlAttribute(AttributeName ="revision")]
string _sRevision = "0.0.0";
[XmlAttribute(AttributeName ="enviroment")]
string _sEnviroment = "Production";
[XmlAttribute(AttributeName ="lang")]
string _sLang = "en-US";
public clsAddRequestForQoute()
{
_sRevision = _sEnviroment;
}
}
-----------
Main()
{
XmlSerializer objSerializer = new
XmlSerializer(typeof(CardoneSolution.Cardone.clsAddRequestForQoute));
using (FileStream fs = new FileStream(@"C:\Documents and
Settings\gt9386\Desktop\AddRequestForQuote1.xml", FileMode.Create ) )
{
clsAddRequestForQoute doc = new clsAddRequestForQoute();
objSerializer .Serialize(fs, doc);
}
}
------------------------------
Thanks..
George
XML is written only with the root element "AddRequestForQoute" and no
attributes like revision or lang.
What am i missing.
----------------------class ------------------------------
[XmlRootAttribute("AddRequestForQoute", Namespace="http://www.test.com")]
public class clsAddRequestForQoute
{
[XmlAttribute(AttributeName ="revision")]
string _sRevision = "0.0.0";
[XmlAttribute(AttributeName ="enviroment")]
string _sEnviroment = "Production";
[XmlAttribute(AttributeName ="lang")]
string _sLang = "en-US";
public clsAddRequestForQoute()
{
_sRevision = _sEnviroment;
}
}
-----------
Main()
{
XmlSerializer objSerializer = new
XmlSerializer(typeof(CardoneSolution.Cardone.clsAddRequestForQoute));
using (FileStream fs = new FileStream(@"C:\Documents and
Settings\gt9386\Desktop\AddRequestForQuote1.xml", FileMode.Create ) )
{
clsAddRequestForQoute doc = new clsAddRequestForQoute();
objSerializer .Serialize(fs, doc);
}
}
------------------------------
Thanks..
George