Rafael Veronezi wrote:
My WinForms app store some kind of data in a structured way... don't need a
database to store that, so I was thinking about store this in a XML file...
I would like to know what's the best method to read/write XML files...
In preview, I'm using DataSets and ReadXml/WriteXml methods... I don't know
if it's the best way.... I know a lot of classes in the System.Xml
Namespace, but I don't know wich of them fits on my needs (simply read/write
sequential data)...
..NET has rich collection of XML related classes, usually each one is
designed to facilitate particular XML usage. But all of them use the
same XML plumbing underneath.
To sequential read/write XML doc you can use XmlReader/XmlWriter, if you
need full document in memory with update option - XmlDocument, readonly
- XPathDocument. System.Data namespace provides classes like
XmlDataDocument and DataSet.
But the most easy your task can be done is using XML serialization -
just create object model of your data and serialize it to a file and
deserialize back in just one call.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel