suggestions on serialization approach

  • Thread starter Thread starter Jeff Jarrell
  • Start date Start date
J

Jeff Jarrell

I am still getting started in dotNet so i don't know what approach to follow
in terms of saving data to an xml file. The data i want to save is a set of
statistics about an event. The statistics can be instances of base "stat"
or it can be a derived class from "stat" which is more complex. My object
here is to have an approach for the writeStats method.

ParentClass
stat()
HandsPlayed (an instance of stat)
HandsWon (an instance of stat)
WinningPercentage (a derived class from stat)

writeStats
initialize xmlfile
for each stat
AddToXml
next
close xmlfile

Serialization may not be the way to go. Seems simpler to just add nodes to
an xml DOM. But thats the old me. What would the dotNet way be in this
situation.

thanks,
jeff
 
I am sure the data set would work. But it seems like i already have a data
representation. I was hoping the DOTNET way would be to simply serialize it
to the disk. The data set means i transform my object information to
dataset, then it is transformed again to xml. I'd like to do the same work
with one transformation object->xml.

Also - on a couple of Serialization approaches I always get the xmlns:xsd
and the xmlns:xsi attributes. I'd like to turn these off. Or just put them
at the top. I don't want to see them on every element.

<stat xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

any help appreciated.
 
Back
Top