在.NET中,您可以使用XmlElement(IsNullable = true)序列化可空元素,结果如下:
<SomeElement xsi:nil="true" />.
但是,我需要能够在任何被删除的字段之后添加xmlns:xsi =“http://www.w3.org/2001/XMLSchema-instance。”
示例:
<SomeElement xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
这可能吗?
答案 0 :(得分:0)
我明白了。这是答案:
[XmlElement(IsNullable = true, Namespace = "http://www.w3.org/2001/XMLSchema-instance")]