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

read and write xml file

how to read and write the xml file in c# and assign to a string

riyas_26
Light Poster
30 posts since Jul 2009
Reputation Points: 9
Solved Threads: 0
 
string xmlData = System.IO.File.ReadAllText(@"C:\test.xml");
      System.IO.File.WriteAllText(@"C:\test.xml", xmlData);
sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
 

Hi Riyas,
as earlier suggested.. you can directly write that xml file into a string and you can print on the webpage.


here textbox1 is a textbox with multiplelines...

protected void Page_Load(object sender, EventArgs e)
    {
        string xmlData = System.IO.File.ReadAllText(@"C:\test.xml");
        System.IO.File.WriteAllText(@"C:\test.xml", xmlData);
        TextBox1.Text = xmlData;
    }
kameswari
Junior Poster in Training
76 posts since Sep 2008
Reputation Points: 13
Solved Threads: 16
 

thank you so much for ur advice... were are you from?

riyas_26
Light Poster
30 posts since Jul 2009
Reputation Points: 9
Solved Threads: 0
 

I'm from Atlanta, Georgia.

Please mark this thread as solved if your question has been answered and good luck!

sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
 

hi kameshwari,

were r u from

riyas_26
Light Poster
30 posts since Jul 2009
Reputation Points: 9
Solved Threads: 0
 

Hi Riyas,
I am from hyderabad (AP) - India... what abt u??

kameswari
Junior Poster in Training
76 posts since Sep 2008
Reputation Points: 13
Solved Threads: 16
 

chennai(TN). when do u come online regularly

riyas_26
Light Poster
30 posts since Jul 2009
Reputation Points: 9
Solved Threads: 0
 

hi daily i will browse these forums ... there is no specific time for browsing ...Anyways to day i'm leaving a bit early.....

bye...

kameswari
Junior Poster in Training
76 posts since Sep 2008
Reputation Points: 13
Solved Threads: 16
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You