Please help me: XML and .NET

SelArom

Senior member
Sep 28, 2004
872
0
0
www.djselarom.com
hi, I've got an xml file and I want to be able to append new entries to the file. Do I have to load the entire xml file into memory, add the entry, then write the whole file back out? I'm sure there has to be a better way, but the only way I know how to work with xml files in .net is the xpath navigator, which requires me to write out a whole new file each time I want to make a change.

can someone tell me a better way? thanks a bunch!

-SelArom
 

igowerf

Diamond Member
Jun 27, 2000
7,697
1
76
Since XML files always have a root element, you can't really just append entries to the end of the file. I would think that you need to read the whole file in to add new entries since you'd actually be inserting values. .NET probably has some excellent functions to help you read and write XML though. I actually just used MSXML to edit some XML in VB6 today and it was really easy to do.
 

SelArom

Senior member
Sep 28, 2004
872
0
0
www.djselarom.com
Originally posted by: igowerf
Since XML files always have a root element, you can't really just append entries to the end of the file. I would think that you need to read the whole file in to add new entries since you'd actually be inserting values. .NET probably has some excellent functions to help you read and write XML though. I actually just used MSXML to edit some XML in VB6 today and it was really easy to do.


thanks for your replies fellas, I figured that the nature of the document would require me to write the whole thing out again, and that's fine. I guess what I meant was, how can I streamline this process so that *I* don't have to do that. like a method like "addentry(stuff)" that will automatically parse through the document, add the entry, then write out the file. is there such a thing?

thanks again!
-SelArom