DataSet.WriteXml(...) does not work correctly on host

Discussion in 'ASP.NET / ASP.NET Core' started by trondb, Jan 19, 2006.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi all,

    I have a page thatuse a dataset to work with XML data. It works perfectly on my machine when I add items to the XML files using DataSet.WriteXml(..)
    It is using the following schema:
    <Ad>
    <Keyword></Keyword>
    <ImageUrl>/</ImageUrl>
    <NavigateUrl></NavigateUrl>
    <AlternateText></AlternateText>
    <Rotated></Rotated>
    </Ad>

    It works fine on my machine - but after uploading to DASP, it only createsthis when attempting to add new rows:
    <Ad>
    <Keyw

    .. It ends here every time - even if I am working with the EXACT same data as on my local computer.

    Any ideas what is causing this irrational behaviour?

    Thanks,

    Trond
     
  2. Sure - it goes something like this:


    DataSet ds = new DataSet();
    ds.ReadXml( Server.MapPath(@"\feeds\lodging_picks.xml"), System.Data.XmlReadMode.Auto );
    DataRowad = new DataRow();ad.Keyword = "test keyword";
    ad.ImageUrl = "/img/test_img.jpg";
    ad.NavigateUrl = "www.testurl.com";
    ad.AlternateText = "test alt text";
    ad.Rotated = "False";
    ds.Tables[0].AddRow(ad);
    ds.WriteXml( Server.MapPath(@"\feeds\lodging_picks.xml" ) )


    Thanks,


    Trond
     
  3. Actually, i got it working by
    1. using DataSet.WriteXml to a temporary file
    2.replace the original file with the temporary file


    I was thinking maybe since this XML file is read every time someone view our web sitemain page, this could create the problem. I still I think it is strange that I had to do this...


    Thanks,


    Trond
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page