0

XmlTextReader -> XmlTextReader.NodeType == XmlNodeType.EndElement

The above written does not return true case of Self enclosing Element Like:

<Default Name= "One"/>

Can any body tell the alternate solution for it. I am able to achieve the desired result by using the XmlTextReader.IsEmptyElement property.

Is there any other way to achieve the desired result?

Christoph Fink
  • 22,727
  • 9
  • 68
  • 113

1 Answers1

1

As the given example is not an end element, but is an empty element your found solution is the correct one. So maybe just check for both cases to get your desired condition:

if (XmlTextReader.NodeType == XmlNodeType.EndElement || XmlTextReader.IsEmptyElement)
Christoph Fink
  • 22,727
  • 9
  • 68
  • 113