Search This Blog

Tuesday, June 16, 2009

Modify XML Data at runtime

view the following link this will help you.

http://support.microsoft.com/kb/317666
Also refer this : -

 protected void fillXml()
    {
        DataSet dsbanner = new DataSet();
        dsbanner = bsadv.getBannerStore();
        string s = Server.MapPath("../aspx/aspxBanner.xml");
        dsbanner.WriteXml(s);
        xml();      
    }
    public void xml()
    {
        try
        {
            // Create an XML document instance, and load XML data.
            XmlDocument doc = new XmlDocument();
            string s = Server.MapPath("~/aspx/aspxBanner.xml");
            doc.Load(s);
            XmlNode nodelist = doc.DocumentElement;
            foreach (XmlNode node in nodelist.ChildNodes)
            {
                foreach(XmlNode node1 in node.ChildNodes)
                {
                    if(node1.Name == "sBannerImageName")
                        node1.InnerText = "../admin/banner/" + node1.InnerText;
                }
            }
            doc.PreserveWhitespace = true;
            XmlTextWriter wrtr = new XmlTextWriter(s, Encoding.Unicode);
            doc.WriteTo(wrtr);
            wrtr.Close();
        }
        catch (Exception ee)
        {
        }
   }

No comments:

Post a Comment