[Mono-list] Xml reading & writing.

Neil Munro neilmunro at gmail.com
Tue Sep 16 21:43:47 EDT 2008


Hey I have what I believe might be quite a common problem, and while I could
find a way to solve it just using my own code, I imagine what I believe is
such a common operation will have a way of solving it.

I have an xml file that is my applications preferences, it's an update tool,
now this update tool can update from multiple sources. If no preferences
file is found on first run, a default set are saved. Now if the user wishes
to add a new update source to the xml file I need to place the
<UpdateSource>blah</UpdateSource> in the correct part of the file, since the
file holds ALL application preferences, I can't just dump a new source at
the end of the text file.

I guess my question is, what's the best way to solve this problem? I mean I
could write a function that reads the document in line by line, storing it
in program then adding a new update source at the correct point (in memory)
then dumping it back to the file, but this seems horribly inefficient.

Thanks
Neil Munro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20080917/20256cd0/attachment.html 


More information about the Mono-list mailing list