Question DataSet ReadXML - How to skip the problematic records?

mullin

New member
Joined
Nov 15, 2010
Messages
1
Programming Experience
Beginner
I'm using DataSet ReadXML() method to load XML files of records different tables, and all are working fine. But, I would like to have the exceptional handling that in case there're records in XML files got problem, e.g. invalid data format or exceed column width and etc, it will skip those records and continue loading remaining XML records into DataSet.

Any ideas of doing so?

Thanks!
 
For ReadXml method you can specify XmlReadMode.IgnoreSchema:
Ignores any inline schema and reads data into the existing DataSet schema. If any data does not match the existing schema, it is discarded (including data from differing namespaces defined for the DataSet).
So this requires the dataset to already hold a preconfigured schema, or one read with ReadXmlSchema.
 
Back
Top