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
  • 54,804
  • 11
  • 122
  • 125
fireholster
  • 622
  • 1
  • 9
  • 22

2 Answers2

2

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

Kirill Polishchuk
  • 54,804
  • 11
  • 122
  • 125
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,839
  • 12
  • 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