Reading XML Files

Tech-Archive recommends: Speed Up your PC by fixing your registry



Can someone please advise the best approach for reading in many 5000+
xml files from disk into a data set. Here is the code so far. On my
computer (may not be best spec) is takes about 3 minutes to read and
load the dataset. It doesn't seem to be the reading of the files as so
much as the loading of the data into the dataset. Any help would be
appreciated.

cenOcr = new DataSet();
// Create the XmlSchemaSet class.
XmlSchemaSet sc = new XmlSchemaSet();

// Add the schema to the collection.
sc.Add(null, Application.StartupPath + "\
\APCenSchema.xsd");
sc.Compile();

XmlReaderSettings cenSettings = new XmlReaderSettings();
cenSettings.Schemas.Add(sc);
cenSettings.ValidationType = ValidationType.Schema;
cenSettings.ValidationEventHandler += new
ValidationEventHandler(cenSettingsValidationEventHandler);

DirectoryInfo dir = new DirectoryInfo(strPathname);
foreach (FileInfo f in dir.GetFiles("*.xml"))
{
/*
* Load XML files into dataset
*
*/
XmlReader ocrResults = XmlReader.Create(f.FullName,
cenSettings);
cenOcr.ReadXml(ocrResults);

}

I have try many differen methods. I tried using the
XmlReadMode.ReadSchema but this did not load any data into the
dataset.

Regards
Phil
.



Relevant Pages

  • Reading / Writing XML files?
    ... But after all this reading, ... Compact Framework development. ... that same data via XML files for remote locations. ... But if I did, are there any specs that I should make sure we ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: easiest way for beginner to start database?
    ... That guy not say he would be reading and writing at the same time. ... If your data is readonly data, then your XML files will work fine. ... But if you need to update data, ... Performance wise XML files will probably perform similar to database ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: New at .Net/C#
    ... being told to do that with XML files and, from what I've seen, reading ... I found two libraries that read/write XML's but, gosh, when I look at the ... implement those principles and best practices in your applications. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: fstab-sync
    ... >> I'd like to make some changes to my mountpoints, ... >> I can't get to just now) suggests reading some XML files and a web ... > there is a man page for fstab-sync. ... controlled through some XML files. ...
    (Fedora)
  • XML/user data...
    ... In my app, I have 3 different XML files that are used to persist data. ... going nuts to try and lower the load time in my app. ...
    (microsoft.public.dotnet.framework.compactframework)