我使用VB.net中的序列化程序生成此XML,如下所示
Dim string_writer As New StringWriter()
Dim serializer As New XmlSerializer(GetType(MyClass))
serializer.Serialize(string_writer, addr)
txttest.Text = string_writer.ToString()
虽然它正在返回XML,但我在所有元素中看到xmlns =“http://tempuri.org/,无论如何我都隐藏了这个。
答案 0 :(得分:0)
当然 - 只需将您要使用的默认命名空间传递给XmlSerializer的构造函数:
Dim string_writer As New StringWriter()
Dim serializer As New XmlSerializer(GetType(MyClass), "")
serializer.Serialize(string_writer, addr)
txttest.Text = string_writer.ToString()
这应该可以解决问题。