469,903 Members | 1,430 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,903 developers. It's quick & easy.

Reading in XML file, changing elements and saving back to the file

Hi

Reading in XML file, changing elements and saving back to the file,
how can i do that, I want to be able to read an XML file and read out
Elements. for example

<name>Tom</tom>

When I read from a file i want to save the XML document in memory of
the computer and when i am finished flush it back to the file, that
means i want to be able to access the element in memory of the
computer and when i change it will write it back with new changes.

What is the Best way to do that ?
I have tried it wiht xmlReader and xmlWrite, this is not saved in the
computer.
Nov 12 '05 #1
2 1377


Gerald Maher wrote:
Reading in XML file, changing elements and saving back to the file,
how can i do that, I want to be able to read an XML file and read out
Elements. for example

<name>Tom</tom>

When I read from a file i want to save the XML document in memory of
the computer and when i am finished flush it back to the file, that
means i want to be able to access the element in memory of the
computer and when i change it will write it back with new changes.


Sounds as if you are looking for System.Xml.XmlDocument

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #2
XMLDocument xdoc = new XMLDocument(@"c:\myfile.xml");

// do the changes to the xdoc (in-memory dom)

xdoc.save(@"c:\myfile.xml");

I think this should work - havent tried it though ;-)

HTH
Kalpesh

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Marco Rispoli | last post: by
6 posts views Thread by Rajorshi Biswas | last post: by
6 posts views Thread by Gerald Maher | last post: by
6 posts views Thread by arne.muller | last post: by
3 posts views Thread by maw | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.