// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Data; using System.IO; using System.Xml; using System.Xml.Schema; namespace E { public class MainClass { public static void ValidationEventHandler (object sender, ValidationEventArgs e) { } public static void Main(string[] args) { DataSet ds = new DataSet("TestDS"); XmlReaderSettings xrs = new XmlReaderSettings(); xrs.ValidationType = ValidationType.Schema; xrs.Schemas.Add(XmlSchema.Read(new StreamReader(@"C:\ds.xsd"), ValidationEventHandler)); XmlReader xr = XmlTextReader.Create(@"C:\ds.xml", xrs); ds.ReadXml(xr); ds.WriteXml(Console.Out); } } }