serialization

How do you deserialize a collection with child collections?

I have a collection of custom entity objects one property of which is an ArrayList of byte arrays. The custom entity is serializable and the collection property is marked with the following attributes: [XmlArray("Images"), XmlArrayItem("Image",typeof(byte[]))] So I serialize a collection of these custom entities and pass them to a web ...

Serialization in C# without using file system

I have a simple 2D array of strings and I would like to stuff it into an SPFieldMultiLineText in MOSS. This maps to an ntext database field. I know I can serialize to XML and store to the file system, but I would like to serialize without touching the filesystem. public override void ItemAdding(SPItemEventProperties properties) { ...

what's the easiest way to generate xml in c++?

I've used boost serialization but this doesn't appear to allow me to generate xml that conforms to a particular schema -- it seems it's purpose was to just to persist a class's state. Platform: linux What do you guys use to generate NOT parse xml? So far I'm going down Foredecker's route of just generating it myself -- it's not a larg...

Deserialize SOAP array in C#

In working with another company I'm trying to write a SOAP client to talk to their service. The service itself has no wsdl-files but I've managed to successfully write my own proxy class inheriting from SoapHttpClientProtocol. Basic methods that only return an integer or a single value is not a problem but when I try to make a method tha...

End of Stream encountered before parsing was completed?

I am trying to deserialize a stream but I always get this error "End of Stream encountered before parsing was completed"? Here is the code: //Some code here BinaryFormatter b = new BinaryFormatter(); return (myObject)b.Deserialize(s);//s---> is a Stream object that has been fill up with data some line over here ...

Xml Serialization and Schemas in .net (C#)

The following questions are about XML serialization/deserialization and schema validation for a .net library of types which are to be used for data exchange. First question, if I have a custom xml namespace say "http://mydomain/mynamespace" do I have to add a [XmlRoot(Namespace = "http://mydomain/mynamespace")] to every class in my...

In C#, How can I serialize Queue<>? (.Net 2.0)

At the XmlSerializer constructor line the below causes an InvalidOperationException which also complains about not having a default accesor implemented for the generic type. Queue<MyData> myDataQueue = new Queue<MyData>(); // Populate the queue here XmlSerializer mySerializer = new XmlSerializer(myDataQueue.GetType()); StreamW...

How to serialize in a class a Soap Fault for a website?

I hope this question is not as cryptic as the other ones I do. I have two components: Web site that recieves Soap Envelopes and Soap Faults WinServices that sends Soap Envelopes. Ok, so the winservices sends SoapEnvelopes and if an error occurs it returns the Soap Envelope with a Soap Fault Inside. Is there a way to serialize the Soa...

C# work around for XmlSerializer.Deserialize pitfall?

I was just wondering if there are any good work-arounds for Deserializing private fields/properties using XmlSerializer.Deserialize() ? Currently, I Deserialize my XML to a simple disposable type with all public properties, then I load the complex type that has private properties like this: ComplexType complex = new ComplexType(SimpleT...

How can I get a JsonResult object as a string so I can modify it?

I am using the FlexiGrid jQuery plug in and I need to get a JSON object back form my MVC App, simple enough if the FlexiGrid took just the object but I need to add a few items to the response string for it to work properly with FlexiGrid. So here is a portion of my controller code: If Request.QueryString("json") IsNot Nothing Then ...

Java Serialization 1.4 vs 1.6

I have one java program that has to be compiled as 1.4, and another program that could be anything (so, 1.4 or 1.6), and the two need to pass serialized objects back and forth. If I define a serializable class in a place where both programs can see it, will java's serialization still work, or do I need 1.6-1.6 or 1.4-1.4 only? ...

Deserialization throws an exception for this bit of C# code

Edit: Closing this because i've found the reason why it's erroring, but instead of removing this post .. i generate a newer post with a more refined question. Hi folks, i have some binary data i've read in. i wish to convert it to an System.Drawing.Image, so i create an instance of an Image object, using a memory stream as the input ...

C++ Serialization Performance

Hi! I'm building a distributed C++ application that needs to do lots of serialization and deserialization of simple data structures that's being passed between different processes and computers. I'm not interested in serializing complex class hierarchies, but more of sending structures with a few simple members such as number, strings ...

Serializing anonymous delegates in C#

I am trying to determine what issues could be caused by using the following serialization surrogate to enable serialization of anonymous functions/delegate/lambdas. // see http://msdn.microsoft.com/msdnmag/issues/02/09/net/#S3 class NonSerializableSurrogate : ISerializationSurrogate { public void GetObjectData(object obj, Serializa...

How do you rename the child XML elements used in an XML Serialized List<string>?

Hello, I'm serializing to XML my class where one of properties has type List<string>. public class MyClass { ... public List<string> Properties { get; set; } ... } XML created by serializing this class looks like this: <MyClass> ... <Properties> <string>somethinghere</string> <string>somethinghere<...

How to ignore a type with XStream?

Hello, with XStream, how can I ignore the serialization of a defined Type (for instance, when serializing a GUI, i want to ignore all swing types)? Or if i want to ignore all javax.* types? Thanks in advance, Burkhard ...

Accessing stored structures for which I have an xml description

I have set up a sort of introspection-enabling C++ library that allows, using minimum macros and a fair amount of template trickery, to declare structures and classes that get enriched with some meta-information. This meta-information captures all important details about each field of the struct/class that you declare, and at the end of...

Why is marshal so much faster than pickle?

From this question and my own benchmarks it seems that the marshal module is about 20-30x faster than cPickle. Why is this so? What functionality does cPickle offer over marshal that justifies this? (Another way of putting it - why not always use marshal? Why do both of these modules exist?) ...

C++ design question - Network packets and serialization

I have, for my game, a Packet class, which represents network packet and consists basically of an array of data, and some pure virtual functions I would then like to have classes deriving from Packet, for example: StatePacket, PauseRequestPacket, etc. Each one of these sub-classes would implement the virtual functions, Handle(), which w...

Serializing objects for asynchronous messaging

I'm considering using AMQP (using qpid) to enable a mixture of Python and Java services communicate with each other. Basic text messaging seems simple enough but, as with every other messaging technology I've investigated, that's where it seems to stop. Except for building instant messaging applications, I would have thought sending stri...