2

I have multiple XML files that I need to parse. Problem is that I only need some data in the last couple of lines.

I currently use XMLTextReader and reader.ReadToFollowing("DATANEEDED"); but it is still too slow. Does anyone know if I can 'tail' an XML file and read from there? (taking into account the tail would not be a valid XML file) or any other ways to retrieve the last few nodes in the XML without parsing through the entire XML file?

I am using .NET 2.0 so no in-built linq :(

Thanks

xt_20
  • 1,406
  • 3
  • 13
  • 27
  • Perhaps see the `(Stream, XmlNodeType, XmlParserContext)` overloaded constructor... you may still have to initially position the stream on a valid element -- I do not know -- but that should move you as fast as you can move the stream :-) –  Jun 22 '10 at 08:37

1 Answers1

-1

XmlDocument is a better choice. Within it use xPath queries. I guess XmlDocument take cares about performance automatically.

Afshar Mohebi
  • 10,479
  • 17
  • 82
  • 126