473,700 Members | 2,393 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 1801
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.x ml"
' Create the FileStream to write with.
Dim myFileStream As New System.IO.FileS tream _
(filename, System.IO.FileM ode.Create)
' Create an XmlTextWriter with the fileStream.
Dim myXmlWriter As New System.Xml.XmlT extWriter _
(myFileStream, System.Text.Enc oding.Unicode)
' Write to the file with the WriteXml method.
thisDataSet.Wri teXml(myXmlWrit er)
myXmlWriter.Clo se()
End Sub

http://msdn.microsoft.com/library/de...teXmlTopic.asp
<um**********@y ahoo.com> wrote in message
news:40******** ******@news.mic rosoft.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**********@y ahoo.com> wrote in message
news:40******** ******@news.mic rosoft.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 "Persistenc e".

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 XMLSerializatio n*.*, 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**********@y ahoo.com> wrote in message
news:40******** ******@news.mic rosoft.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
3824
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 element) without Parent property serialized, this may be done by adding XmlIgnoreAttribute on the...
4
3131
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
4485
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
9793
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 fails and gives me the following error: Binary stream does not contain a valid BinaryHeader, 0...
3
2065
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
1249
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 nested objects, collections, ...). I think this process will work very well, also the
8
3464
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 server I can intercept the SOAP message (XML doc itself),
1
1897
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” attribute as shown below:
5
6028
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 GAC (no policy redirects exist).
3
2641
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 many places, and don't want to provide custom serialization routines for every single object that...
0
8726
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9214
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9075
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7810
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6561
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4404
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4657
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3089
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2028
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.