Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML reader writer

Status
Not open for further replies.

henslecd

MIS
Apr 21, 2003
259
US
I am looking for a good tutorial on reading, writing and modifying XML in C#.

This is the approach I think I should use.

Read the XML file and put it in a dataset. Manipulate the dataset as needed, and write it back out to the XML file. I guess I am suppose to blow away the entire XML file before doing this?

Is there a way to just delete/update a "line" of XML as opposed to blowing it away and recreating the entire file? Is this practical?

Thanks,

Chad

 
I think XML is misused too much in this manner. An XML file is not a replacement for a database to act as a dynamic datasource where multiple clients can change the data. A simple ACCESS mdb is much more versatile if you are doing more than just reading the data.
Maybe a database is more efficient if the poster is going to have multiple clients accessing the same datasource (they don't actually say if they are or not) but personally, if I was going to use a database, I would not use access. There are plenty of free and easy install databases (the express version of SQL Server for example) that are much more suited to the job.

If the poster is simply using the XML file to store simple details, and they manage the modification of the XML
file correctly (i.e. limit access to one person at a time) then there shouldn't be any problems and this would be a situation where XML may be a good choice.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Rtomes,

XML is a requirement. I would much rather use a db.

Ca8msm,

There will be only one person accessing it at a time.

Can anyone answer my question about having to blow away the entire XML file and recreating it everytime there is a modification?

Thanks
 
By "blow away" do you mean do you have to delete it and then create it each time? If so, then no as when writing files to disk you can specify whether to overwrite an existing file if it exists.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
No, I mean delete the content of the XML file, and reqrite everything again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top