http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx
is stateless and only retains information about the current node, so if
you are reading the content of an element and wish to know the elements
name you need to make sure that when you read the start element node
you somehow retain the element name.
Again if you want to know the name of the parent element you need to
retain this information / state yourself as you read through the xml
document.
If you wish to start reading at a particular node you should go
through and read the xml document node by node until you read the node
you wish to start at.
Ultimately reading xml via the XmlReader class is more difficult than the alternatives, generally speaking you would only use XmlReader if the the xml document is very large, in most other cases using one of the alternatives:
- Linq to XML
- The http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx class
- Using http://msdn.microsoft.com/en-us/library/x6c1kb0s%28v=vs.71%29.aspx to generate a .Net class from a XSD file that can be used to serialise and deserialise xml via the http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx class.
For more information see http://msdn.microsoft.com/en-us/library/ms950721.aspx
If you really want to use XmlReader then you should read http://msdn.microsoft.com/en-us/library/e4w1e57w%28v=vs.80%29.aspx.