473,473 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

overwrite a serialized object

I'm serializing an object into a file in XML. After the object is
serialized, some other relevant data is written into the file. The rest
of the data winds up being very large most of the time.

Is there a way to re-serialize the object over itself? Here's a quick
example:

Say I have this:

<?xml version="1.0" encoding="utf-8"?>

<fileroot>

<SerializedObject>
<intParam>6</intParam>
<doubleParam>4.68</doubleParam>
</SerializedObject>

<otherData>blarg</otherData>

</fileroot>

Is it possible to replace the SerializedObject without disrupting the
rest of the data?

Thanks,

Lee Crabtree
May 8 '06 #1
6 1689
Correct me ... if i'm not mistaken, all you want is, remove the
SerializedObject node and append new node in that place?

Yes it is possible... ping here, for more...
--
Every thing is perfect, as long as you share!!!
"Lee Crabtree" wrote:
I'm serializing an object into a file in XML. After the object is
serialized, some other relevant data is written into the file. The rest
of the data winds up being very large most of the time.

Is there a way to re-serialize the object over itself? Here's a quick
example:

Say I have this:

<?xml version="1.0" encoding="utf-8"?>

<fileroot>

<SerializedObject>
<intParam>6</intParam>
<doubleParam>4.68</doubleParam>
</SerializedObject>

<otherData>blarg</otherData>

</fileroot>

Is it possible to replace the SerializedObject without disrupting the
rest of the data?

Thanks,

Lee Crabtree

May 10 '06 #2
That's right. What I've tried has worked as long as what is being
appended is the same size as what's being overwritten. Otherwise,
excess garbage sits on the end, or I overwrite data beyond the
serialized object.

Lee

Chakravarthy wrote:
Correct me ... if i'm not mistaken, all you want is, remove the
SerializedObject node and append new node in that place?

Yes it is possible... ping here, for more...

May 10 '06 #3
What is the mechanism did you use to append the data to XML elements?
Secondly, there is no restriction about the size that matters while appending
or deleting...

Post the code, to help you better
--
Every thing is perfect, as long as you share!!!
"Lee Crabtree" wrote:
That's right. What I've tried has worked as long as what is being
appended is the same size as what's being overwritten. Otherwise,
excess garbage sits on the end, or I overwrite data beyond the
serialized object.

Lee

Chakravarthy wrote:
Correct me ... if i'm not mistaken, all you want is, remove the
SerializedObject node and append new node in that place?

Yes it is possible... ping here, for more...

May 10 '06 #4
Well, I couldn't use the XmlDocument class, as it is a full cache tree
of the file. A file of several hundred megs is prohibitively large and
slow, and I can't afford that kind of pain. So I was using
XmlTextReaders and XmlTextWriters to change the data and write it back.
But, as I said, data was either overwritten or underwritten.

Lee

Chakravarthy wrote:
What is the mechanism did you use to append the data to XML elements?
Secondly, there is no restriction about the size that matters while appending
or deleting...

Post the code, to help you better

May 10 '06 #5
Morantex
9 New Member
Hi

I have just read your post about mpdifying a serialized object.

I want to draw your attention to a new technology we have recently made available in beta.

Persistore is the first managed class library for .NET 2 that provides access to persistent shared memory.

Now I am not 100% clear on your situation, but there may be some use in taking Persistore for a "test drive". One thing it supports is the ability to call ReadObject, WriteObject, UpdateObject and DeleteObject on [Serializable] .NET objects and supports multiple versions of an object.

These objects are serialized into shared memory (and hence they are persistent) this is a fast operation because there is no disk IO involved.

Persistore basically implements its own shared memory file system and allows you to create directories in which to store data. Because of its nature it is used to store variables and arrays as well as files (known as SharedStreams) and offers services unavailable in other products.

Get the beta from our site: http://www.morantex.com/Persistore.aspx and do not hesitate to contact me with questions or requests, we are working on the next beta and keen to address any real-world customer needs.


Regards
Hugh

hugh.moran@morantex.com




Well, I couldn't use the XmlDocument class, as it is a full cache tree
of the file. A file of several hundred megs is prohibitively large and
slow, and I can't afford that kind of pain. So I was using
XmlTextReaders and XmlTextWriters to change the data and write it back.
But, as I said, data was either overwritten or underwritten.

Lee

Chakravarthy wrote:[color=blue]
> What is the mechanism did you use to append the data to XML elements?
> Secondly, there is no restriction about the size that matters while appending
> or deleting...
>
> Post the code, to help you better[/color]
May 10 '06 #6
Ken Getz, is another MVP and one of his webcast will help you in detail about
how to handle the nodes insertion and deletion. You can reach his website for
this, i would suggest you to spend some time to listen what he says and go
ahead with your work.

At this link, http://www.mcwtech.com/2004/webcasts/ you can find all his
contributions towards the dev community, among which you also see the XML DOM
topic with the title, "Using the XML DOM in .NET Applications"

Dont think that instead of listening to him, you can do R&D over internet
.... this will be definitly helpful to you...

--
Every thing is perfect, as long as you share!!!
"Lee Crabtree" wrote:
Well, I couldn't use the XmlDocument class, as it is a full cache tree
of the file. A file of several hundred megs is prohibitively large and
slow, and I can't afford that kind of pain. So I was using
XmlTextReaders and XmlTextWriters to change the data and write it back.
But, as I said, data was either overwritten or underwritten.

Lee

Chakravarthy wrote:
What is the mechanism did you use to append the data to XML elements?
Secondly, there is no restriction about the size that matters while appending
or deleting...

Post the code, to help you better

May 11 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Russ | last post by:
Hi, What's the easiest way of modifying an object which has been serialized to a DB? The previous developer created a complex object hierarchy and binary serialized the whole thing to a single...
0
by: Ray Mitchell | last post by:
Hello, The result of auto-converting some Java code to C# yielded the following upgrade issue regarding the original Java call to "reset()": public virtual void writeObj(Object obj) {...
0
by: Wim Hollebrandse | last post by:
Here's the scenario. I'm serializing a particular object, which contains other objects as properties. I have this particular enum type that won't get included in the serialized XML. For...
0
by: Pierre | last post by:
Hi, I'm trying to select specific nodes from a XmlDocument filled with a serialized object and to insert these nodes into another XmlDocument. The object is well serialized (see below). From a...
2
by: Dennis C. Drumm | last post by:
Is there a way to open files with .net 1.1 versions of my software product that were serialized with a .net 2.0 version of same product? Right now, as soon as my older .net 1.1 application tries to...
5
by: EqDev | last post by:
I have a class that is a control derived from UserControl. I want to use serialization and deserialization with this calss but I get an exception "Cannot serialize member...
3
by: MMiGG | last post by:
Hi Our project need parse JAVA serialized object string in C, has any library? Thanx
1
by: Phil Galey | last post by:
I'm using XMLSerializer in VB.NET to serialize class-based objects to XML. It's serializing fine, except that I don't seem to have control over the order in which the various fields (properties) of...
0
by: bharathreddy | last post by:
Before going to that i want to say few thing on serialization : Serialization is the process of converting an object into a form that can be readily transported. For example, you can serialize an...
0
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...
0
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,...
0
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...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.