XML Namespace & Serialization

G

Guest

We have an object structure which maps to an XML Schema we have defined. This
schema has complex types which are causing XML Namespace information to be
embedded into the XML when we use the XMLSerializer to serialize the objects.
Do you know if there is a way to prevent the namespace information from being
embedded in the XML by the serializer?

-Tammy
 
K

Kevin Spencer

Why do you want to do this?

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Accept the Unexpected.
 
G

Guest

This is how we are serializing the object:

writer = new XmlTextWriter(new MemoryStream(), enc);
XmlSerializer serializer = new XmlSerializer(o.GetType());
serializer.Serialize(writer, o);
byte[] bytes = ((MemoryStream)writer.BaseStream).ToArray();
writer.Flush();
return enc.GetString(bytes, 0, bytes.Length).Trim();

The object itself has multiple namespaces in it since it declares an
instance of another object b for example which is in a different namespace
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top