Is there a way to avoid self-closing tags when using XML Serialization?

假装没事ソ 提交于 2019-12-14 00:56:26

问题


I am working with VB.NET and I am facing a problem with XML serialization. When empty values exists in the object I am serializing, the XML file contains the following tags:

<tagName/>

instead of:

<tagName></tagName>

I know that it's the same, but I want the start tag to close appropriately.


回答1:


They are the same and it makes no difference. Any parser or reader understands the meaning, so why is this so important to change?

I find the current behavior better as it will result in smaller files.

Regardless, there is no way to override this behavior.



来源:https://stackoverflow.com/questions/4932093/is-there-a-way-to-avoid-self-closing-tags-when-using-xml-serialization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!