I am using XmlReader in .NET to parse an XML file using a loop:
while (xml.Read()) {
switch xml.NodeType {
case XmlNodeType.Element:
//Do something
case XmlNodeType.Text:
//Do something
case XmlNodeType.EndElement:
//Do something
}
}
I was wondering if it was normal that the following XML code does not produce some EndElement nodes? Please note the missing space before the /> but I don't think that's the problem.
<date month="November" year="2001"/>
<zone name="xml"/>
Is there a different NodeType or property to indicate a self-closing element?
question from:
https://stackoverflow.com/questions/241336/xmlreader-self-closing-element-does-not-fire-a-endelement-event 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…