XML ASP.Net

<%@ Page Language="C#"%>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.Schema" %>
    
    private StringBuilder stringBuilder = new StringBuilder();
    void Page_Load(object sender, EventArgs e)
    {
        string xmlPath = MapPath("Authors.xml");    
        string xsdPath = MapPath("Authors.xsd");
        XmlReaderSettings settings = new XmlReaderSettings();
        settings.ValidationType = ValidationType.Schema;
        settings.Schemas.Add(null, XmlReader.Create(xsdPath));
        
        XmlReader reader = XmlReader.Create(xmlPath, settings);          
        XmlDocument doc = new XmlDocument();          
        doc.Load(reader);
        ValidationEventHandler eventHandler = new ValidationEventHandler(ValidationEventHandler);
        
        doc.Validate(eventHandler);        
        if (stringBuilder.ToString() == String.Empty)
            Response.Write("Validation completed successfully.");
        else
            Response.Write("Validation Failed. 
" + stringBuilder.ToString());
    }
    void ValidationEventHandler(object sender, ValidationEventArgs args)
    {        
        stringBuilder.Append("Validation error: " + args.Message + "
");                
    }    
  



    XSD Validation