954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Xsl Transformation, XML - saving data

Hi.

I am trying to build simple web application in ASP.NET.
I have xml file with data and xsl file to transform xml file into html doc which will be presented in the browser window and everything is working fine.
What funcionallity do I want?
I want user to enter some text into textboxes and I want this data to be saved into source xml file by clicking for example Save button - I think that it is reversion of transformation process (from html into xml). Can I do something like that? Is it hard to achieve?

regards

krokodajl
Light Poster
31 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

>Can I do something like that? Is it hard to achieve?
Yes you do that using methods of DataSet class and it is very easy.

string file=MapPath("~/text.xml");
  DataSet ds = new DataSet();
  DataTable dt = null; 
  if (!System.IO.File.Exists(file))
            {
                // Create an instance of DataTable
                dt = new DataTable("Test");
                dt.Columns.Add("foo");
                dt.Columns.Add("bar");
                ds.Tables.Add(dt);
            }
            else
            {
                ds.ReadXml(file);
                dt = ds.Tables["Test"];
            }
   dt.Rows.Add("value1", "value2");
   ds.WriteXml(file);
__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: