Re: Serializing XmlDocument to SerializationInfo



Dave Sexton wrote:

Hi Sam,

That depends on the reason why you are serializing the TextDocument and its
containing object in the first place. Your could save the TextDocument to a file,
possibly on a web server, and serialize a path string. During deserialization
locate the file (and download it if necessary), then reload it into a TextDocument.
You might have to download the document asynchronously, so the client should
be aware of any possible caveats.

Dave,

Thank you for your reply!

I have two types of serialization going on. One is to a file and the
other is across the wire. The application I am working on is a
client/server app where currently both are on the same physical
machine, in version 2, they can be on separate machines, but all in the
same local area network. There is no plain to ever make this system
work over the Internet or use any web server type of things.

The XML is created in an XmlDocument object that is the raw data for a
report. The XmlDocument object is being added to a C# business class
call "ReportDocument" which contains additional information. It is
within this Report class that I need to figure out how to serialize the
XmlDocument.

The code that writes a ReportDocument to file is generic, right now at
least, to how all documents within the system are written to file and
they all depend on the object implementing the ISerializable interface.
I am using standard remoting to send objects across the wire, right
now, too. So both remoting and writing to file is using ISerializable.

After some testing, it looks like if the text within the XML is
compressed, I can get the size down to under half a meg of data, so I
would be comfortable with serializing that size of binary blob. In the
short term, I think this is the best approach. Is there a better one?

Assuming my approach, I figure I can stream the XmlDocument to a memory
stream and then compress the memory stream, but I am back at how best
to stream this compresed blob into the SerializationInfo. Any
thoughts?

Sam

.



Relevant Pages

  • Re: reading in C++ a binary serialized object from .net
    ... serializing and de-serializing various data at the site ... > a binary stream coming from a .net object standard serialization. ... > MyObject obj = new MyObject; ... > IFormatter formatter = new BinaryFormatter(); ...
    (microsoft.public.dotnet.framework.interop)
  • Re: reading in C++ a serialized object from .net
    ... For example,> let's assume I have a .net client which serializes some "POD" objects> using the standard .net serialization mechanism, then writes them to a> network stream, and finally a C++ server receives this stream, reads ... > - any kind of specification of the .net binary format used when> serializing objects? ... > MyObject obj = new MyObject; ...
    (microsoft.public.dotnet.general)
  • Re: Serialize A Dictionary
    ... I would like to pass my stream in a URL. ... >> I am thinking that I might have to roll my own very lightweight class. ... >>> Andrew, ... Yes, you are serializing the entire object, which means ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: End of Stream encountered before parsing was completed
    ... Can you elloborate on code level. ... It's very possible that the stream is closed for some reason (network ... buffer, then deserialize from that. ... I've serializing an object to a Network stream but when trying to ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: byte representation of a class
    ... > object but not in a stream and not ... Objects use references to other objects to store data. ... to make a portable byte representation of a class without serializing ...
    (comp.lang.java.programmer)