Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Serialization/Deserialization or XML as DB

Reply
Thread Tools

Serialization/Deserialization or XML as DB

 
 
umbertoeklat@yahoo.com
Guest
Posts: n/a
 
      05-11-2004

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
 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      05-11-2004
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


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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


 
Reply With Quote
 
 
 
 
Yuancai \(Charlie\) Ye
Guest
Posts: n/a
 
      05-12-2004
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


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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



 
Reply With Quote
 
Sahil Malik
Guest
Posts: n/a
 
      05-14-2004
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/



<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
Print XML parsing to JspWriter (out) Class org.xml.sax.helpers.NewInstance can not access a member of class javax.xml.parsers.SAXParser with modifiers "protected" Per Magnus L?vold Java 0 11-15-2004 02:27 PM
embedding xml in xml as non-xml :) Mark Van Orman XML 5 09-15-2004 05:57 AM
What XML technologies to learn first for "XML Processing" and "XML Mapping"? Bomb Diggy Java 0 07-28-2004 07:26 AM
Help on including one XML document within another XML document using XML Schemas Tony Prichard XML 0 12-12-2003 03:18 PM



Advertisments