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 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
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...
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...
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
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]
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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)
{...
|
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...
|
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...
|
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...
| |
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...
|
by: MMiGG |
last post by:
Hi
Our project need parse JAVA serialized object string in C, has any library?
Thanx
|
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...
|
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...
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |