Slowness of XmlDocument Class

  • Thread starter Thread starter Justin
  • Start date Start date
J

Justin

I'm working with the compact framework and trying to write a program that
will roll through a xml document and display the information in a listbox,
but after I open a file with a OpenFileDialog it takes up to 15 seconds to
load the file into the XmlDocument. Any Ideas on how to speed the code up.
My xml file is around 200k. Here is a sample of the code that i'm using.

lstCaches.Items.Clear();

OpenFileDialog GetGPX = new OpenFileDialog();

GetGPX.Filter = "GPX files (*.GPX)|*.gpx|All files (*.*)|*.*";

GetGPX.ShowDialog();

FileName = GetGPX.FileName;

if(FileName != "")

{

XmlDocument GpxDoc = new XmlDocument();



GpxDoc.Load(GetGPX.FileName);

}



Thanks,

Justin
 
Why don't you consider using an XmlReader, this is remarkably faster than
the XmlDocument... or is there a reason why you would absolutely have to
use the XmlDocument?
 
Back
Top