how to get xml content and edit xml file by using C#

I have an XML file called Emails.xml:

<Root>
  <Emails>
     <address>dfg@fds.com</address>
  </Emails>
  <Emails>
    <address>adsfZSdf@.com</address>
  </Emails>
</Root>

Um...I'm using visual studio, asp.net. I want to get the addresses by using C# code and also edit one or more addresses(e.g. chage "dfg@fds.com" to "ddfla@fds.com"). Furthermore, add new address(es) to this xml file. (path of xml file is: C:\Documents and Settings\Administrator\Desktop\Emails.xml)

How can I do that?

Answers


Use the XmlDocument class. Then you can filter to the addresses with a call to GetElementsByTagName(string). From there, modification should be easy.


Need Your Help

How do I force a Java subclass to define an Annotation?

java annotations subclass

If a class defined an annotation, is it somehow possible to force its subclass to define the same annotation?

How can I reenable autocomplete support for just 1 site in my whole struts project?

java jsp caching autocomplete struts

since I'm trying to solve this problem for some days, I thought about giving you guys a chance. The situation:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.