开发者

Can XmlTextReader tell the difference between <tag> and <tag />

开发者 https://www.devze.com 2023-01-04 22:38 出处:网络
I am reading an XML file using an XMLTextReader. Is there a way to tell the difference between a start tag (lik开发者_如何学Goe <tag>) and a self-terminating tag (like <tag />)If you mean

I am reading an XML file using an XMLTextReader. Is there a way to tell the difference between a start tag (lik开发者_如何学Goe <tag>) and a self-terminating tag (like <tag />)


If you mean the difference between <tag></tag> and <tag />, then the answer is no, as both are equivalent in XML, and you should not depend on this in your code.


Use IsEmptyElement property

0

精彩评论

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