开发者

How can I customize the ending node style while saving an XmlDocument?

开发者 https://www.devze.com 2023-02-23 06:04 出处:网络
Simply put, after calling XmlDocument.Save method, I want the resulting xml look like this: <somenode />

Simply put, after calling XmlDocument.Save method, I want the resulting xml look like this:

<somenode />

instead of this:

<somenode></somenode>

Can I achieve this?

I don't think how I constructed the XmlDocument matters. I just have such an instance, make开发者_C百科 some changes and save it. I want to know if it's possible to control the formatting for empty node.

Thanks, Nico


It's done automatically for elements that have no child elements, and it's illegal for elements that have child elements... so I'm not sure what you're trying to do here.

0

精彩评论

暂无评论...
验证码 换一张
取 消