473,516 Members | 2,865 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serialization/Deserialization or XML as DB


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
3 1794
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3819
by: Snowman | last post by:
Suppose I have a RootObject which holds a collection of other objects. The other objects have a property (Parent) which refers back to the "parent" collection (b.t.w. my collection is based on CollectionBase), in similar fashion as the object models of MS Office. I want to serialize this object graph (with RootObject as the xml document...
4
3121
by: Jeff T. | last post by:
Hello, I have an existing set of C# classes that encapsulate our application data. They are in a heirachy with each subclass defining more specific types of data. I would like to serialize these data objects as XML but perserve the relationships in the XML document. For example, if my classes were: public class GenericItem { }
1
4469
by: Maheal | last post by:
I have been trying to Serialize an object that is the child of another object which is also serializable. Here is the simplified scenario (assume missing code is correct): class One : ISerializable { int x; int y; One() {}; // constructor One(SerializationInfo i, StreamingContext c) { // deserialization
3
9784
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I am having problems deserializing an object which seems to be serializing just fine. I save the byte array of the serialized object in the database (when I check the database the field that holds the binary data seems populated), but when I want to deserialize this same byte array the application...
3
2053
by: AnkitAsDeveloper [Ankit] | last post by:
Hi i am serializing a 'ref struct' object as follows : private: void Seri( String ^path, Object^ obj ) { FileStream^ fileStrm ; try { //Serialize entire object into Binary stream
0
1239
by: Goethals Frederik | last post by:
Hi, I have some questions that are a little difficult to explain, so I give it a try... I have an application (aSP.NET with VB.NET codebehind) and I would like to store my data on disk because the users could continue later on there project with the same data already filled in. So I would use the soap-serialization to store the info (the...
8
3446
by: ashoksrini | last post by:
Hi All, I have the below requirement and would like to get some feeback from the group on the best way to implement: 1. I have WSDL defined exposing few web services. 2. We dont have a requirement to have a server web service class. (reasons below) 3. I want to develop something like this - when client makes a web service call, on the...
1
1888
by: Rucha | last post by:
We are using ACAServices in our project, and are passing entity classes as parameters to the ACAServiceMethod. We are using a private variable entityState to indicate whether the entity is new/updated and so on. At present we are not using any custom serialization in our project, we just decorate the entity class with “Serializable”...
5
6007
by: Harold Howe | last post by:
I am having a problem deserializing objects from a library when the following conditions exist: 1- The library is strongly named 2- The serialized file was created with version 1.0 of the assembly 3- I am trying to deserialize from an EXE that references version 2.0 of the assembly 4- Both version 1.0 and 2.0 of the assembly reside in the...
3
2621
by: Zachary Turner | last post by:
Hello, I have a situation where I would like to perform custom serialization and deserialization of an existing .NET framework object (specifically, System.DateTime). Is there a common paradigm here, for how I can override the default behavior of DateTime serialization and provide my own? I want to use this custom serialized DateTime in...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7142
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5714
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4773
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.