XML ASP.Net

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Xml" %>

    void Page_Load(object sender, EventArgs e)
    {
        //string xmlFilePath = @"C:\Data\Employees.xml";
        string xmlFilePath = MapPath("Employees.xml");
        try
        {
            using (XmlReader reader = XmlReader.Create(xmlFilePath))
            {
                string result;
                while (reader.Read())
                {
                    //Process only the elements
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        result = "";
                        for (int count = 1; count <= reader.Depth; count++)
                        {
                            result += "===";
                        }
                        result += "=> " + reader.Name;
                        lblResult.Text += result;
                        // check if the element has any attributes
                        if (reader.HasAttributes)
                        {
                            lblResult.Text += " (";
                            for (int count = 0; count < reader.AttributeCount; count++)
                            {
                                //Read the current attribute
                                reader.MoveToAttribute(count);
                                lblResult.Text += reader.Name;
                            }
                            lblResult.Text += ")";
                            //Instruct the parser to go back the element 
                            reader.MoveToElement();
                        }
                        lblResult.Text += "
";
                    }
                }
            }
        }
        catch (Exception ex)
        {
            lblResult.Text = "An Exception occurred: " + ex.Message;
        }        
    }



    Reading an XML File and attributes using XmlReader


    
    

        
    

    


<%--


      
    
      Nancy
      Lee 
    

    Seattle
    WA
    98122   
  
      
    
      Jason
      Wang
    

    Vancouver
    WA
    98123   
   

--%>