Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim xs As New XmlSerializer(GetType(cEmploymentDetail))
- Dim ns As New XmlSerializerNamespaces()
- ns.Add("", "")
- Dim settings As New XmlWriterSettings()
- settings.OmitXmlDeclaration = True
- Using ms As New MemoryStream(), _
- sw As XmlWriter = XmlWriter.Create(ms, settings), _
- sr As New StreamReader(ms)
- xs.Serialize(sw, obj, ns)
- ms.Position = 0
- Console.WriteLine(sr.ReadToEnd())
- End Using
- //Create our own namespaces for the output
- XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
- //Add an empty namespace and empty value
- ns.Add("", "");
- //Create the serializer
- XmlSerializer slz = new XmlSerializer(someType);
- //Serialize the object with our own namespaces (notice the overload)
- slz.Serialize(myXmlTextWriter, someObject, ns);
- // Add lib namespace with empty prefix
- ns.Add("", "http://schemas.YourCompany.com/YourSchema/");
Add Comment
Please, Sign In to add comment