E
elgrego
Hi,
I have been implementing the IXmlSerializer.
This is the class definition:
[Serializable]
[XmlSchemaProvider("GetSchema")]
[XmlRoot("Company")]
public class Company : BusinessDataBase, IXmlSerializable
With the WriteXml:
/// <summary>
/// Writes this object as Xml.
/// </summary>
/// <param name="writer"></param>
public override void WriteXml(XmlWriter writer)
{
writer.WriteStartElement(SHBXmlSchema.GetRootElementName(this.GetType()));
writer.WriteAttributeString("name", _Name.ToString());
writer.WriteAttributeString("countryId", _CountryId.ToString());
writer.WriteAttributeString("sectorId", _SectorId.ToString());
writer.WriteAttributeString("id", _Id.ToString());
writer.WriteEndElement();
}
The question is;
When I use the XmlSerializer to serialize <Company> comes out twice.
BUT! When I get the same object over a web service I only get it once!?
Is the XmlRoot ignored? Why?
What I am looking for is a consistent way to serialize/deserialize my objects.
By the way, the generated objects in the web reference is something I delete and then add my
namespaces in "using"
Any advice is good. I am beginning to gnaw my arm off....
Regards / Greger
I have been implementing the IXmlSerializer.
This is the class definition:
[Serializable]
[XmlSchemaProvider("GetSchema")]
[XmlRoot("Company")]
public class Company : BusinessDataBase, IXmlSerializable
With the WriteXml:
/// <summary>
/// Writes this object as Xml.
/// </summary>
/// <param name="writer"></param>
public override void WriteXml(XmlWriter writer)
{
writer.WriteStartElement(SHBXmlSchema.GetRootElementName(this.GetType()));
writer.WriteAttributeString("name", _Name.ToString());
writer.WriteAttributeString("countryId", _CountryId.ToString());
writer.WriteAttributeString("sectorId", _SectorId.ToString());
writer.WriteAttributeString("id", _Id.ToString());
writer.WriteEndElement();
}
The question is;
When I use the XmlSerializer to serialize <Company> comes out twice.
BUT! When I get the same object over a web service I only get it once!?
Is the XmlRoot ignored? Why?
What I am looking for is a consistent way to serialize/deserialize my objects.
By the way, the generated objects in the web reference is something I delete and then add my
namespaces in "using"
Any advice is good. I am beginning to gnaw my arm off....
Regards / Greger