0

I am reading a XMl and using it for some processing in my application.

var config =  XElement.Load("c:/sample.xml");

Is there anyway to do load it in a better way? it takes a while while trying to process this line of code.

Kirill Polishchuk
  • 52,773
  • 10
  • 120
  • 121
fireholster
  • 552
  • 1
  • 7
  • 19

2 Answers2

2

Look at XmlReader class, it provides fast, noncached, forward-only access to XML data.

Kirill Polishchuk
  • 52,773
  • 10
  • 120
  • 121
1

You use so call DOM model of loading document which loads the whole XML. An alternative is a SAX model when you read data in consecutive manner. The API for that is XmlReader

evhen14
  • 1,779
  • 11
  • 16
  • There is a Java article but it will give you an idea of what's going on http://cafeconleche.org/books/xmljava/chapters/ch09s11.html – evhen14 Nov 19 '13 at 00:44