Reading XML Files
- From: pkenderdine@xxxxxxxxx
- Date: Tue, 13 May 2008 23:34:15 -0700 (PDT)
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
.
- Follow-Ups:
- Re: Reading XML Files
- From: Chris Nahr
- Re: Reading XML Files
- Prev by Date: Re: .Net question
- Next by Date: Re: Public member of a Namespace unavailable outside the namespace
- Previous by thread: Provide a link to a secure website from a WinForms application
- Next by thread: Re: Reading XML Files
- Index(es):
Relevant Pages
|