public static string GetXmlString(object xmlClassObject)
{
try
{
XmlSerializer serializer = new XmlSerializer(xmlClassObject.GetType());
StringWriter Output = new StringWriter(new StringBuilder());
serializer.Serialize(Output, xmlClassObject);
string tmpReturnString = Output.ToString().Replace("<?xml version=\"1.0\" encoding=\"utf-16\"?>", "<?xml version=\"1.0\" encoding=\"utf-8\"?>");
return tmpReturnString;
}
catch
{
throw;
}
}
{
try
{
XmlSerializer serializer = new XmlSerializer(xmlClassObject.GetType());
StringWriter Output = new StringWriter(new StringBuilder());
serializer.Serialize(Output, xmlClassObject);
string tmpReturnString = Output.ToString().Replace("<?xml version=\"1.0\" encoding=\"utf-16\"?>", "<?xml version=\"1.0\" encoding=\"utf-8\"?>");
return tmpReturnString;
}
catch
{
throw;
}
}
No comments:
Post a Comment