serialization

Serialize an inline List of Objects

This is bothersome and seemingly rare to figure out. But what I have is the need to serialize a list of objects into XML without the containing list element. For instance: public class Book { public string Name { get; set; } } public class Library { public List<Book> Books { get; set; } } I need to write it like so: <Librar...

Why is Java Swing serializable?

When I create Swing apps for remote users, I just create jar files and create a WebStart file to let users download the app and then run it. I haven't heard of application servers serving up JFrames, etc, like JSPs. Was that the original intent? ...

Why Java needs Serializable interface?

We work heavily with serialization and having to specify Serializable tag on every object we use is kind of a burden. Especially when it's a 3rd-party class that we can't really change. The question is: since Serializable is an empty interface and Java provides robust serialization once you add implements Serializable - why didn't they...

Unknown exception while deserializing using simple XML

I am deserializing data using Simple XML in Java, but i get an exception telling me: protokolsimulering.model.Terminal.<init>() This is my serializing code: public void saveSimulationState(String simulationFile) { try{ Strategy strategy = new CycleStrategy("id", "ref"); Serializer serializer = new Persister(strate...

What's the best way to serialize JavaScript objects to XML ?

I am looking for a best proved way to serialize JavaScript objects to XML, that could be sent to server further in Ajax style. Just googling I've found some options like http://svn.mirekrusin.com/pub/javascript/to_xml/trunk/to_xml.js, but does somebody has proved experience and could recommend any specific library? ...

Is there a market amongst programmers for an OID-keyed blob store?

A friend has developed a very amazing blob store and I think it needs to be used, but I'm wondering whether people think such a thing has a market, and if programmers ever get to make these kinds of decisions. It has support for online backups using deltas and is much faster than anything I know of, it's undergone rigorous testing and b...

Java - Modifying serialVersionUID of binary serialized object

A few months back I serialized a java.io.Serializable object into a file. Now I need to read the contents, but since then the serialVersionUID has changed, and now I'm getting a "class incompatible" error. I know for a fact that none of the data members have changed, so the only barrier is the serialVersionUID check. Is there a way to...

What is object serialization?

What is meant by "object serialization"? Can you please explain it with some examples? ...

C# enumeration property null vs. 0

I'm using IIS/asmx to support a Flash client. Some of my service layer data transfer objects have properties that are enumeration values. There are cases where these properties should be null. When an object with a null value for such an enumeration property is rendered to soap, I receive this error: System.InvalidOperationExceptio...

Conflict between avoiding anemic model and allowing serialization

In this answer to a recent question, I was advised to "be wary of making every property in your domain model have public getters and setters. That can lead you to an anemic domain model." However I then encounter the problem that an entity with private setters, like this: public class Phrase { public int PhraseId { get; private set...

XmlSerialization of mutiple object types in the one list

I have an object that has a list of abstract 'aninamls'. i.e. var animals = new Animals { new Bird{ TailFeatherColour = "Blue" }, new Cat{ Colour = "Brown" } }; using the xmlserializer, is it possible to serialize the above to the following xml, <?xml version="1.0" encoding="utf-16"?> <Animals> <Bird> <TailFeatherC...

Reverse (parse the output) of Arrays.toString(int[])

Is there in the JDK or Jakarta Commons (or anywhere else) a method that can parse the output of Arrays.toString, at least for integer arrays? int[] i = fromString(Arrays.toString(new int[] { 1, 2, 3} ); ...

Strange behaviour of .NET binary serialization on Dictionary<Key, Value>

I encountered a, at least to my expectations, strange behavior in the binary serialization of .NET. All items of a Dictionary that are loaded are added to their parent AFTER the OnDeserialization callback. In contrast List does the other way. This can be really annoying in real world repository code, for example when you need to add som...

Error deserialising XML document with strongly typed XSD

Hello, I am running into quite an annoying issue while trying to deserialise a specific XML document using XmlSerializer.Deserialize() method. Basically, I have a strongly typed XSD with an element of type double. When trying to deserialise the element for a specific XML document, I get the usual "System.FormatException: Input string ...

How to generically specify a Serializable List

I have the following interface: public interface Result<T extends Serializable> extends Serializable{ T getResult(); } With that interface, I can not define a variable of type Result<List<Integer>> because List is not serializable. However, if I change the interface to this: public interface Result<T> extends Serializable{ ...

Problems with combining Serialization and DataBinding

Actually i'm working with C# and already got DataBinding and Serialization to work. But now i'd like to combine both methods in one class and i have a little problem with it. So let's start with a little sample class: using System; using System.Runtime.Serialization; using System.Windows.Forms; namespace MySample { [DataContract(I...

c++ xml data binding

There are several comparisons of the different java xml data binding tools online. I'd like to see this become a useful comparison between the different c++ tools for xml data binding. Which tool are you using for xml data binding in c++ ? CodeSynthesis and xmlbeanscxx are a couple of the available choices. I'd like everyone to add...

How Serialization Works in .Net

I have a feeling this is a repost but I can't seem to find any good information about it. I was just wondering how serialization actually works (well actually deserialization). What I'm wondering is if say I have a property that is not actually backed by a private field; i.e.: public string SomeProp { get { return GetValue("Som...

Switching to Release Build causes runtime error in Web Reference

I've got a problem with a SOAP Web Reference that was generated by Visual Studio 2005 (.NET framework is v2.0.50727.42) - it works fine under the Debug build configuration (and has for months) but now that I want to go live and have compiled using the Release configuration, it has stopped working. Exceptions are raised at runtime whenev...

Java ME object persistence

I know that Serialization (Serializable) is not available in the Micro Edition of Java. It's kinda straight forward to save primitives like int and java.lang.String objects with the RMS. But if I want to save (make persistant) an arbitrary object? Is that possible? ...