generate runtime xml in asp.net
<p>i have genarated a xml file through the asp.net code as</p>

<pre><code> public bool createxml()
    {
        DataSet ds = new DataSet();
        clsRegister obj = new clsRegister();
        int i = 0;
        string strpath = string.Empty;
        XmlTextWriter objwriter = new XmlTextWriter(Console.Out);
        ds = obj.searchgallery(4);
        try
        {
            strpath = "d:\\hellojhasi\\glance\\jhansigallery\\gallery.xml";
            objwriter = new XmlTextWriter(strpath, System.Text.Encoding.Default);
            if (ds.Tables[0].Rows.Count &gt; 0)
            {

                for (i = 0; i &lt; ds.Tables[0].Rows.Count; i++)
                {
                   objwriter.WriteStartElement("picturegallery");
                    objwriter.WriteElementString("fullimage", ds.Tables[0].Rows[i]["fullimage"].ToString());
                    objwriter.WriteElementString("thumbnail", ds.Tables[0].Rows[i]["thumbnail"].ToString());
                    objwriter.WriteElementString("title", ds.Tables[0].Rows[i]["title"].ToString());
                    objwriter.WriteElementString("description", ds.Tables[0].Rows[i]["description"].ToString());
                    objwriter.WriteElementString("height", ds.Tables[0].Rows[i]["height"].ToString());
                    objwriter.WriteElementString("width", ds.Tables[0].Rows[i]["width"].ToString());
                    objwriter.WriteEndElement();
                }
            }
            else
            {

                objwriter.WriteEndElement();
            }
            objwriter.Flush();

        }
        catch (Exception e)
        {
        }
        return true;
    }
</code></pre>

<p>the code executed well.
but the xml file when opens gives the following error</p>

<p>The XML page cannot be displayed 
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. </p>

<hr>

<p>Only one top level element is allowed in an XML document. Error processing resource 'file:///D:/HelloJhasi/glance/jhansigal...</p>

<p>can anyone plz help me with this</p>
