This Blog Has Been Moved !

This Blog Has been moved to http://aleemkhan.wordpress.com

This is extremely trivial XML Schema Validator; I just needed to verify my XML against a Schema File. Very simple code but maybe helpful to someone.

 

using System;

using System.Xml;

using System.IO;

using System.Xml.Schema;

 

namespace XmlConsole

{

      /// <summary>

      /// Summary description for Class1.

      /// </summary>

      class Class1

      {

            private static int errors = 0;

            /// <summary>

            /// The main entry point for the application.

            /// </summary>

            [STAThread]

            static void Main(string[] args)

            {

                  try

                  {

                        // The Source XML File

                        XmlTextReader xtr = new XmlTextReader("C:\\devresult.xml");

                        XmlValidatingReader reader = new XmlValidatingReader(xtr);

                        reader.ValidationType = ValidationType.Schema;

           

                        // The Path of the XML Schema File against which the Validation is to be made.

                        // you can add more than one Files by using reader.Schemas.Add()

                        reader.Schemas.Add(null,new XmlTextReader(@"E:\Schema.xsd"));

                        reader.ValidationEventHandler += new ValidationEventHandler(reader_ValidationEventHandler);

                        while(reader.Read());

                       

                        xtr.Close();

                        reader.Close();

                       

                        if(errors == 0)

                              System.Console.WriteLine("Validation Successfull");

                        else

                              System.Console.WriteLine("Validation Failed");

                       

                        System.Console.ReadLine();

                  }

                  catch(Exception exp)

                  {

                        System.Console.WriteLine(exp.Message);

                        errors ++;

                  }

                                                     

            }

            private static void reader_ValidationEventHandler(object sender, ValidationEventArgs e)

            {

                  System.Console.WriteLine(e.Message);

            }

      }

}

 

Comments

8 comments have been posted.
Anonymous Anonymous
Posted @ 4:01 PM
You want to ensure that you select a Nuviante robe that appears smashing, however no longer trashy. deciding on robes that praise your pores and skin tone, don�t display an excessive amount of flesh, and feature tasteful patterns make a contribution to ensuring that you will appearance poised and swish in your next festival.For more ==== >>>>>> http://ultimatemuscleblackeditionrev.com/nuviante/
 

Anonymous Anonymous
Posted @ 3:47 PM
The thesis is embraced as part of the Grow XL coursework which complements the essential capabilities of a student to put together him for making a profession as a behavioral scientist.an area where applied Psychology is broadly embraced is sports activities.For more ==== >>>>>> http://ultimatemuscleblackeditionrev.com/grow-xl/
 

Anonymous Anonymous
Posted @ 4:00 PM
One method that will help you with this Megadrox is referred to as visualization . it's miles the practice of mentally picturing your self as you would like to be and focusing all of your energies on reaching that purpose.For more ==== >>>>>> http://novusantiagingserumrev.com/megadrox-reviews/
 

Anonymous Anonymous
Posted @ 4:30 PM
What we want in energy for the subsequent GROW XL leap forward in code-dealing with is to have table top machines which are possibly a billion billion instances extra powerful and faster than the fastest machines sitting on our tables today.For more ==== >>>>>> http://ultimatemuscleblackeditionrev.com/grow-xl/
 

Posted @ 3:13 PM
The sharing of a story is a special Opti Memory way to spend time with your grandchildren. Every child loves and appreciates a good story that captivates their imagination and keeps them entertained.For more ==== >>>>>> http://realcemasculinobr.com/opti-memory/
 

Posted @ 1:58 PM
These purses had been specially taken Blackcore Edge Max into consideration crucial via travelers. The wealth or fame of the provider was generally shown with the aid of the adornment of jewelry.For more ==== >>>>>> http://www.healthsupreviews.com/blackcore-edge-max-review/
 

Anonymous Anonymous
Posted @ 2:57 PM
Some precautions should be taken in Grow XL the course of exercising as a pregnant woman is at a threat of a premature hard work. The pregnant lady have to never exercising to exhaustion and ought to prevent exercise whilst she feels out of breath or has any difficulty in speaking.For more ==== >>>>>> http://www.healthsupreviews.com/grow-xl/
 

Posted @ 5:13 PM
Erectify Ultra Reviews manufacturers must investigate all high-end quality herbs and different parts to formulate these pills that contain enough nutrients for your balanced diet daily. Intake of male enhancement pill is one among the simplest suggested cures by doctors for Erectify Ultra infertility problems. Supplements made out of herbal ingredients scale back the chance of adverse actions on users. Read more: http://www.healthsuppreviews.com/erectify-ultra-reviews/