0

在使用 XMLBeans 生成 XML 时,

xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"被插入。

例如 :

<element xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

但我只需要<element/>

请建议。提前致谢。

4

1 回答 1

1

我只能建议在 setter 中放置一个空(默认)值,将其保留为 null 将导致 nil 的事情,另一种方法是您可以删除 nil 属性:

xnode.RemoveAttribute("nil", "http://www.w3.org/2001/XMLSchema-instance");

其中 xnode 是具有 nil 值的节点。

希望有帮助

于 2012-03-12T10:20:40.860 回答