Can XmlTextReader tell the difference between <tag> and <tag />
-
01-10-2019 - |
Question
I am reading an XML file using an XMLTextReader. Is there a way to tell the difference between a start tag (like <tag>
) and a self-terminating tag (like <tag />
)
Solution
Use IsEmptyElement property
OTHER TIPS
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow