Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Deserialization and Namespaces


Message #1 by "Pedro Gualandi" <pedro_gualandi@h...> on Tue, 5 Feb 2002 16:41:01
I'm trying to use the XmlSerializer class to deserialize a string to XML. 
The problem is that "blank" namespace declarations (xmlns='') are 
being "inserted" on the resulting XML. How can I prevent this situation ? 

==================
The C# Code
==================

..... some stuff here

mystring = "<b>1</b><c>2</c>"
myresult = (new XmlSerializer(typeof(mytype))).Deserialize(new StringReader
(mystring));

.... some stuff here

==================
The Resulting XML
==================

<something><b xmlns="">1</b><c xmlns="">1</c></something>

  Return to Index