Thomas Morrison

Thomas Morrison

  • NA
  • 10
  • 19.4k

XML bombs out when can't locate element

Sep 11 2010 3:28 PM


Hi, 

I'm using simple XML parsing:


                     XmlTextReader textReader = new XmlTextReader("http://somewhere.com");

                    textReader.Read();textReader.ReadToFollowing("someElement");

Games.Add(textReader.ReadElementContentAsString());


but when it can't find someElement my code bombs out with

The ReadElementContentAsString method is not supported on node type None. 

How do I test when it's exhausted all occurrences of the element. I can't find anything useful


Thanks

Thomas


Answers (1)