Connecting Tech Pros Worldwide Forums | Help | Site Map

Moving the XmlTextReader.Read() pointer back to the start?

Blink
Guest
 
Posts: n/a
#1: Nov 11 '05
I'm using the XmlTextReader class to parse an XML feed. I need to search for
elements that may or may not be there; for example, if there was an error
with my request the XML will contain an <error> element. If there was
nothing wrong this element won't be in it. My problem with this is that
after searching through the XML the first time looking for the <error>
element using the XmlTextReader.Read() method, I can't search for any other
element because the Read() pointer is at the end.

Is there anyway to move it back to the beginning so I can search for other
elements? I've tried XmlTextReader.MoveToElement("startElement") and
XmlTextReader.ResetState() but these don't do what I want them to.

Any ideas? Failing that, can anyone suggest any other reasonably efficient
way to read the XML that provides recordset-like navigation?

TIA.



Closed Thread


Similar .NET Framework bytes