• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Please help me: XML and .NET

SelArom

Senior member
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
 
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.
 
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
 
Back
Top