If you want to omit the default namespace declaration upon serializing an object to file, i.e.
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
and
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance",
you should add a default (empty) namespace to the call to serialize the object. See below:
// Omit the standard namespaces from the output
XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
namespaces.Add(string.Empty, string.Empty);
// Write the data to a the temp file using a xml writer
XmlSerializer serializer = new XmlSerializer(typeof(vodData));
using (XmlWriter writer = XmlWriter.Create(sourceFilePath, settings))
{
serializer.Serialize(writer, data, namespaces);
}
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
and
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance",
you should add a default (empty) namespace to the call to serialize the object. See below:
// Omit the standard namespaces from the output
XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
namespaces.Add(string.Empty, string.Empty);
// Write the data to a the temp file using a xml writer
XmlSerializer serializer = new XmlSerializer(typeof(vodData));
using (XmlWriter writer = XmlWriter.Create(sourceFilePath, settings))
{
serializer.Serialize(writer, data, namespaces);
}