I am sending a request to a web service that requires a string containing XML from which I am providing XSD.
I ran xsd.exe and created a class based on this, but not sure if the best way is to create an xml string to send, such as a stream, XMLDocument, or some form of serialization.
UPDATE
I found here here
public static string XmlSerialize(object o)
{
using (var stringWriter = new StringWriter())
{
var settings = new XmlWriterSettings
{
Encoding = Encoding.GetEncoding(1252),
OmitXmlDeclaration = true
};
using (var writer = XmlWriter.Create(stringWriter, settings))
{
var xmlSerializer = new XmlSerializer(o.GetType());
xmlSerializer.Serialize(writer, o);
}
return stringWriter.ToString();
}
}
which allows me to control the tag attribute.
source
share