XML ASP.Net

<%@ Page Language="C#"%>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Reflection" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.Schema" %>
    
    private StringBuilder stringBuilder = new StringBuilder();
    void Page_Load(object sender, EventArgs e)
    {        
        string xsdPath = MapPath("Authors.xsd");        
        XmlSchema schema = null;
        FileStream stream = new FileStream(xsdPath, FileMode.Open);
        schema = XmlSchema.Read(stream, new ValidationEventHandler(ValidationEventHandler));
        stream.Close();        
        schema.Compile(new ValidationEventHandler(ValidationEventHandler));        
        if (schema.IsCompiled)
            DisplaySchemaObjects(schema);        
        else
            Response.Write("Schema Reading Failed. 
" + stringBuilder.ToString());
    }
    
    void DisplaySchemaObjects(XmlSchema schema)
    {
        foreach (XmlSchemaElement elem in schema.Elements.Values)
        {            
            if (elem.ElementSchemaType is XmlSchemaComplexType)
            {                
                Response.Write("Complex Element: " + elem.Name + "
");
                XmlSchemaComplexType ct = (XmlSchemaComplexType)elem.ElementSchemaType;                                
                //Process the XmlSchemaComplexType                
            }
        }             
    }
    void ValidationEventHandler(object sender, ValidationEventArgs args)
    {        
        stringBuilder.Append("Validation error: " + args.Message + "
");                
    }    
  



    Reading XSD Schema


    
    
                
    

    


<%-- Authors.xsd


  
    
      
        
          
            
              
              
              
              
              
              
              
              
              
            

          

        
      

    

  

--%>