If you are in .NET 2.0, you can also use XmlReader.ReadSubtree to create a new XmlReader whose scope is the current element node of your first XmlReader. This allows you to manipulate that node as its own document. You can't manipulate the first XmlReader while the second one is open, however. When you are done with the subtree reader, the original XmlReader is positioned at the end element of the subtree.
See the docs at:
http://msdn2.microsoft.com
It is not clear what you mean by "so that I didn't have to read the entire element if I didn't have to". You can always Skip an element if you do not need to read more of it. You probably don't want to combine the XmlReader and XmlDocument as that is for extracting the entirety of an interesting element into a DOM. You seem to want to be able to read a portion of an element and then move on. From the sound of it, I doubt you need ReadSubtree either.
Maybe a few more details of your problem woudl help.
Main Topics
Browse All Topics





by: cpkilekofpPosted on 2007-09-06 at 14:46:27ID: 19843966
http://msdn2.microsoft.com /en-us/lib rary/ ms998 559.aspx#s calenetcha ptch09%20_ topic8
This reference focuses on improving XML performance, and specifically addresses the large-file scenario. For your problem, I recommend looking at "Consider combining XmlReader and XmlDocument" as this specifically allows you to look at child elements of unfinished parent elements.