N
Norbert Pürringer
Hello,
does anyone know how to serialize an object to xml by using tabs as
indent instead of spaces.
My serializer code looks like following:
public static XmlDocument Serialize(object serializableObject)
{
XmlSerializer responseSerializer = new
XmlSerializer(serializableObject.GetType());
StringBuilder sb = new StringBuilder();
StringWriter writer = new StringWriter(sb);
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
try
{
ns.Add("", null);
ns.Add("xsd", "http://www.w3.org/2001/XMLSchema-instance");
responseSerializer.Serialize(writer, serializableObject, ns);
}
catch (Exception ex)
{
if (ex is InvalidOperationException)
throw ex.InnerException;
else
throw ex;
}
XmlDocument xmlResponse = new XmlDocument();
xmlResponse.LoadXml(sb.ToString());
return xmlResponse;
}
Thank you,
Norbert
does anyone know how to serialize an object to xml by using tabs as
indent instead of spaces.
My serializer code looks like following:
public static XmlDocument Serialize(object serializableObject)
{
XmlSerializer responseSerializer = new
XmlSerializer(serializableObject.GetType());
StringBuilder sb = new StringBuilder();
StringWriter writer = new StringWriter(sb);
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
try
{
ns.Add("", null);
ns.Add("xsd", "http://www.w3.org/2001/XMLSchema-instance");
responseSerializer.Serialize(writer, serializableObject, ns);
}
catch (Exception ex)
{
if (ex is InvalidOperationException)
throw ex.InnerException;
else
throw ex;
}
XmlDocument xmlResponse = new XmlDocument();
xmlResponse.LoadXml(sb.ToString());
return xmlResponse;
}
Thank you,
Norbert