using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Schema;
using System.Xml;
using System.IO;

namespace XsdValidation
{
   class Program
   {
      static void Main(string[] args)
      {
         XmlDocument items = new XmlDocument();
         items.Load(@"..\..\..\..\przedmioty.xml");
         XmlSchema schema = XmlSchema.Read(
            new FileStream(@"..\..\..\..\przedmioty.xsd", FileMode.Open),
            new ValidationEventHandler(OnSchemaValidate));
         items.Schemas.Add(schema);
         items.Validate(new ValidationEventHandler(OnValidate));
         Console.ReadLine();
      }

      static void OnValidate(object sender, ValidationEventArgs vargs)
      {
         Console.WriteLine(vargs.Message);
      }

      static void OnSchemaValidate(object sender, ValidationEventArgs vargs)
      {
         Console.WriteLine(vargs.Message);

      }
   }
}
