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");
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.Load(xmlPath);
        XmlElement authorElement = (XmlElement) xmlDoc.DocumentElement.SelectSingleNode("//authors/author[authorID='000-00-0001']");
        authorElement.SetAttribute("rntsoft", "rntsoft");
        XmlNodeReader nodeReader = new XmlNodeReader(xmlDoc);
        XmlReader reader = null;        
        XmlReaderSettings settings = new XmlReaderSettings();
        settings.ValidationEventHandler += new ValidationEventHandler(this.ValidationEventHandler);
        settings.ValidationType = ValidationType.Schema;        
        settings.Schemas.Add(null, XmlReader.Create(xsdPath));
        reader = XmlReader.Create(nodeReader, settings);
        while (reader.Read()) 
        {            
        }
        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 + "
");                
    }    
  



    DOM Validation


    
    
                
    

    


<%-- File: Authors.xml


  
    000-00-0001
    Nancy
    Lee
    999 999-9999
    
9999 York St.

    Regina
    LA
    99999
    true
  

  
    000-00-0002
    First
    Last
    415 986-7020
    
No Name St.

    Vancouver
    BC
    88888
    true
  
 

--%>
<%-- File: Authors.xsd


  
    
      
        
          
            
              
              
              
              
              
              
              
              
              
            

          

        
      

    

  

--%>