本文介绍了XML结束标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的问题。我正在创建一个XML文档,当没有值avalaible => 1时,我需要有以下两种形式:<参数/> 2.<参数> < /参数> 在一种情况下,我需要第一种,在某些情况下我需要第二种。我应该如何填充该xml元素的值,以便获得第二种类型?我正在尝试string.empty或"""但是它仍然是第一个类型返回给我的是提前谢谢。
解决方案这两种形式在语义上是等价的,所以对所有形式都无关紧要XML解析器。 如果你真的需要获得第二种类型,你可以参考这篇文章找到解决方案:social.msdn.microsoft/Forums/en-US/xmlandnetfx/thread/3a04e78b-3663-4b50-b4e4- 0b05a7633a06 。
Hi, I have this kind of problem. I am creating an XML document and I need to have following two forms, when there is no value avalaible => 1. <Parameter /> 2. <Parameter></Parameter> In one case I need first one and under certain circumstances i need second one. How should I fill the value of that xml element, so I will get second type? I was trying string.empty or "" but it still returned me first type Thanks in advance.
解决方案 The two forms are semantically equivalent, so it does not matter for all XML parsers.In case you really need to get the second type, you can refer to this post for the solution: social.msdn.microsoft/Forums/en-US/xmlandnetfx/thread/3a04e78b-3663-4b50-b4e4-0b05a7633a06.更多推荐
XML结束标记
发布评论