you can use ReadToFollowing("Item") to jump to each Item - however, you need
to be careful, as the "intuitive" code might be (IIRC) wrong:
while(reader.ReadToFollowing("Item")) {
string content = reader.ReadElementContentAsString();
// do something with content
}
The reason this is wrong is that ReadElementContentAsString progresses
/past/ the [Item] element, so the next call to ReadToFollowing() might skip
the next row; you might be able-to do something with a sub-reader, else you
might need to check (after calling ReadElementContentAsString) if you are on
an Item element; if you are, it is the *next* one, so read it; if you
aren't, then ReadToFollowing
Marc
"CodeRazor" <Co*******@discussions.microsoft.com> wrote in message
news:C1**********************************@microsof t.com...
I am reading an xml file from a URL. I was originally doing this using the
XmlDocument class. But this was very slow. The XmlTextReader is meant to
be
much quicker for forward only retrieval of data.
I need to somehow access a particular list of nodes. e.g. I want to loop
through all the nodes called <item></item>. How is this possible using
XmlTextReader?
I can see that you can get the .Value property of XmlTextReader. But I
want
to be able to specify the node I want to look at.
e.g.
<Group>
<Items>
<Item>content here</Item>
<Item>some more content here</Item>
<Items>
<Activity></Activity>
<Location></Location>
</Group>
thanks.
CR