By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,276 Members | 2,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,276 IT Pros & Developers. It's quick & easy.

Serialization/Deserialization or XML as DB

P: n/a

as a proof of concept, am trying create a web app w/ an XML file as a
temp DB

What is the fastest way to do serialization/deserialization?
or maybe the better question would be how to efficiently
retrieve/save data to an xml file.

have tried deserializing from XML file but having a hard time on
mulitple records...
sample codes would be nice :)

thanks
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
The fastest way is to use a dataset. You can use ds.WriteXml and ds.ReadXml
quite easily.

Private Sub WriteXmlToFile(thisDataSet As DataSet)
If thisDataSet Is Nothing Then
Return
End If
' Create a file name to write to.
Dim filename As String = "myXmlDoc.xml"
' Create the FileStream to write with.
Dim myFileStream As New System.IO.FileStream _
(filename, System.IO.FileMode.Create)
' Create an XmlTextWriter with the fileStream.
Dim myXmlWriter As New System.Xml.XmlTextWriter _
(myFileStream, System.Text.Encoding.Unicode)
' Write to the file with the WriteXml method.
thisDataSet.WriteXml(myXmlWriter)
myXmlWriter.Close()
End Sub

http://msdn.microsoft.com/library/de...teXmlTopic.asp
<um**********@yahoo.com> wrote in message
news:40**************@news.microsoft.com...

as a proof of concept, am trying create a web app w/ an XML file as a
temp DB

What is the fastest way to do serialization/deserialization?
or maybe the better question would be how to efficiently
retrieve/save data to an xml file.

have tried deserializing from XML file but having a hard time on
mulitple records...
sample codes would be nice :)

thanks


Nov 18 '05 #2

P: n/a
Hi,
XML/web service sounds fantastic, but it is truely very very bad from
the view of performance. As long as you consider your application
performance, you should never use it under any cases. It is always bad to
serialize or deserialize a large data in XML format using disk, memory,
network or whatever. See the article entitled as Performance comparison
between SocketPro and dotNet remoting at
http://www.udaparts.com/articles/fastsocketpro.htm

DON'T USE XML/WEB SERVICE AS LONG AS YOU CONSIDER PERFORMANCE!

--
Yuancai (Charlie) Ye

Fast and securely accessing all of remote data sources anywhere with
SocketPro using batch/queue, asynchrony and parallel computation

See 30 well-tested and real OLEDB examples

RDB, a tool for fast and securely accessing remote databases with dial-up,
cable, DSL and wireless modems anywhere
www.udaparts.com
<um**********@yahoo.com> wrote in message
news:40**************@news.microsoft.com...

as a proof of concept, am trying create a web app w/ an XML file as a
temp DB

What is the fastest way to do serialization/deserialization?
or maybe the better question would be how to efficiently
retrieve/save data to an xml file.

have tried deserializing from XML file but having a hard time on
mulitple records...
sample codes would be nice :)

thanks

Nov 18 '05 #3

P: n/a
Ok first of all, I think we are talking about persistence, not
serialization.

Imagine you filling a bucket with a hose. The process of the water moving
thru the hose is called as serialization, and the filling of the bucket is
called as "Persistence".

Anyway, the fastest way to do persistence, I feel is to create a class that
represents your data. The class is marked [Serializable]. Then use Binary
formatter to Serialize it to a memory-mapped file. A memory mapped file is
what in short the OS will take care of persistence, but it stays in RAM, so
it's ultra fast. (and easy to implement too). Now if this were a web
application, you could use advanced techniques like caching (asp.net), or
object pooling (COM interop), to get even better performance benefit. ...
man this is getting exciting as we go :).

See - thats the catch, Your proof of concept doesn't need to do XML
persistence, because Binary would be SO MUCH quicker, and then you could
obviously set [xmlelement] on each of the class's public properties, to
convert it to xml using XMLSerialization*.*, which might I add is entirely
different from BinaryFormatter, and SoapFormatter, and easily within memory
convert it to XML - should you need it - though once you have represented
your data as a serializable class - I see no need to involve XML here :).

- Sahil Malik
Independent Consultant
You can reach me thru my blog - http://dotnetjunkies.com/WebLog/sahilmalik/

<um**********@yahoo.com> wrote in message
news:40**************@news.microsoft.com...

as a proof of concept, am trying create a web app w/ an XML file as a
temp DB

What is the fastest way to do serialization/deserialization?
or maybe the better question would be how to efficiently
retrieve/save data to an xml file.

have tried deserializing from XML file but having a hard time on
mulitple records...
sample codes would be nice :)

thanks

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.