如何在序列化类时删除默认的xmlns条目[重复]

时间:2023-01-13 00:13:55

I've instantiated a class that is serializable, and I'm serializing it to a file, but it is always putting the following attributes in my root element:

我已经实例化了一个可序列化的类,我将它序列化为一个文件,但它始终在我的根元素中添加以下属性:

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 

How can I stop that?

我怎么能阻止它?

1 个解决方案

#1


This was alreayd asked on Stack Overflow

这是在Stack Overflow上提出的问题

Remove empty xmlns="" after Xml Serialization

在Xml序列化后删除空xmlns =“”

#1


This was alreayd asked on Stack Overflow

这是在Stack Overflow上提出的问题

Remove empty xmlns="" after Xml Serialization

在Xml序列化后删除空xmlns =“”