c# - check if xmlReader is concrete end element -


i've got xmlreader set , can check elements, cant find way check closing element, lets want have case statement </perls> tag in addition opening one, how this? know sure such tag not self closing.

using (xmlreader reader = xmlreader.create("perls.xml")) {     while (reader.read())     {     // detect start elements.     if (reader.isstartelement())     {         // element name , switch on it.         switch (reader.name)         {         case "perls":             // detect element.             console.writeline("start <perls> element.");             break;         case "article":             // detect article element.             console.writeline("start <article> element.");             // search attribute name on current node.             string attribute = reader["name"];             if (attribute != null)             {             console.writeline("  has attribute name: " + attribute);             }             // next read contain text.             if (reader.read())             {             console.writeline("  text node: " + reader.value.trim());             }             break;         }     }     } } 

how check if nodetype equals xmlnodetype.endelement, :

if (reader.nodetype == xmlnodetype.endelement) {     .... } 

for reference : http://www.codingeverything.com/2013/05/extending-xmlreader-class-isendelement.html


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -