Slowness of XmlDocument Class

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
 
M

Mark Ihimoyan [MSFT]

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top