I serialize a Vehicle object with the following code to serialize the object:
XmlSerializer serializer = new XmlSerializer(typeof(Vehicle));
using (StreamWriter sw = new StreamWriter(RESULTS_FILE_PATH_))
using (XmlWriter writer = new XmlTextWriter(sw))
{
try
{
serializer.Serialize(writer, vehicles[0]);
}
catch (Exception exception)
{
Console.WriteLine("Exception thrown: " + exception);
}
}
The results are as follows:
<?xml version="1.0" encoding="utf-8"?>
<Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<modelYear xmlns="urn:configcompare4g.kp.chrome.com">2014</modelYear>
<subdivisionName xmlns="urn:configcompare4g.kp.chrome.com">Buick</subdivisionName><modelId
</Model>
I need the format to be like this:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ModelArrayElement xmlns="urn:configcompare4g.kp.chrome.com">
<model>
<modelYear>2014</modelYear>
<subdivisionName>Buick</subdivisionName>
</model>
</ModelArrayElement>
</S:Body>
</S:Envelope>
Does anyone have any suggestions on how I can produce the proper format?