serialization

How to serialize a graph structure?

Flat files and relational databases give us a mechanism to serialize structured data. XML is superb for serializing un-structured tree-like data. But many problems are best represented by graphs. A thermal simulation program will, for instance, work with temperature nodes connected to each others through resistive edges. So what is the...

Reading VC++ CArchive Binary Format (or Java reading (CObArray))

Is there any clear documentation on the binary formats used to serialize the various MFC data structures? I've been able to view some of my own classes in a hex editor and use Java's ByteBuffer class to read them in (with automatic endianness conversions, etc). However, I am currently running into issues while trying to bring over the ...

.NET serialization class design problem

We have a rather large object graph that needs to be serialized and deserialized in a lot of different ways (modes). In some modes we want certain properties to be deserialized and in some we don't. In future modes it might also be possible that there are more options for properties than yes or no. The problem is now how we implement the...

Crash Instantiating System.Xml.Serialization.XmlSerializer in C#.

We're seeing a crash when instantiating an instance of the System.Xml.Serialization.XmlSerializer class in a C# library. The crash occurs in the constructor, when it tries to add a duplicate key to a dictionary. I've included a stack trace below. This crash is only occurring on one machine, and repairing our installation of .NET 3.5 d...

XMLSerialization in C#

I have a simple type that explicitly implemets an Interface. public interface IMessageHeader { string FromAddress { get; set; } string ToAddress { get; set; } } [Serializable] public class MessageHeader:IMessageHeader { private string from; private string to; [XmlAttribute("From")] string IMessageHeade.FromAddress ...

XmlSerializer - There was an error reflecting type

Using C# .NET 2.0, I have a composite data class that does have the [Serializable] attribute on it. I am creating an XMLSerializer class and passing that into the constructor: XmlSerializer serializer = new XmlSerializer(typeof(DataClass)); I am getting an exception saying: There was an error reflecting type. Inside the data class t...

Has anyone used the Hessian binary remoting protocol to bridge applications using Java and .NET?

Hessian is a custom binary serialization protocol, (which is open-source - I think), that forms the basis for a binary cross platform remoting framework. I'd like to know if anyone here has used it, and if so, what sort of performance can we expect from a solution that bridges a Java app on one side with a C# app on the other. (Let us co...

WCF Datacontract free serialization (3.5 SP1)

Has anybody got this to actually work? Documentation is non existent on how to enable this feature and I get missing attribute exceptions despite having a 3.5 SP1 project. ...

How can I get a more compact serialization of an image?

I am serializing a JPEG Image in c#.net. I am simply converting it into a byte steam and sending it through web service. I observed that serialized byte stream is 30 times more than that of the size of actual image. Can any one suggest me a better approach to serialize and stay relative to the size of the actual image? ...

Delphi Component Serialization

Has anyone run into issues serializing components into a file and reading them back, specifically in the area where the component vendor upgrades the VCL components. For example a file serialized with DelphiX and then years later read back with delphiY. Do the serialization formats change and if so what can be done to prevent errors re...

.NET XML Seralization

I'm working on a set of classes that will be used to serialize to XML. The XML is not controlled by me and is organized rather well. Unfortunately, there are several sets of nested nodes, the purpose of some of them is just to hold a collection of their children. Based on my current knowledge of XML Serialization, those nodes require ...

How to check if an object is serializable in C#

I am looking for an easy way to check if an object in C# is serializable. As we know you make an object serializable by either implementing the ISerializable interface or by placing the [Serializable] at the top of the class. What I am looking for is a quick way to check this without having to reflect the class to get it's attributes. ...

Should a Log4J logger be declared as transient?

I am using Java 1.4 with Log4J. Some of my code involves serializing and deserializing value objects (POJOs). Each of my POJOs declares a logger with private final Logger log = Logger.getLogger(getClass()); The serializer complains of org.apache.log4j.Logger not being Serializable. Should I use private final transient Logger log...

XML Serialize boolean as 0 and 1

Hello Everybody. The XML Schema Part 2 specifies that an instance of a datatype that is defined as boolean can have the following legal literals {true, false, 1, 0}. The following XML, for example, when deserialized, sets the boolean property "Emulate" to true. <root> <emulate>1</emulate> </root> However, when I serialize the obj...

Understanding how Ada serializes a record

I would like to be able to predict what will be in the resulting binary when I call Write in Ada to serialize a record. Do you know where I can look this up? I have some legacy Ada software that produces a binary file by Write-ing a record, and I need to debug a C++ program that is supposed to write a compatible binary file. So, I would...

Ruby code for quick-and-dirty XML serialization?

Given a moderately complex XML structure (dozens of elements, hundreds of attributes) with no XSD and a desire to create an object model, what's an elegant way to avoid writing boilerplate from_xml() and to_xml() methods? For instance, given: <Foo bar="1"><Bat baz="blah"/></Foo> How do I avoid writing endless sequences of: class Fo...

How do I map XML to C# objects

I have an XML that I want to load to objects, manipulate those objects (set values, read values) and then save those XMLs back. It is important for me to have the XML in the structure (xsd) that I created. One way to do that is to write my own serializer, but is there a built in support for it or open source in C# that I can use? ...

What is the correct way to make a custom .NET Exception serializable?

More specifically, when the exception contains custom objects which may or may not themselves be serializable. Take this example: public class MyException : Exception { private readonly string resourceName; private readonly IList<string> validationErrors; public MyException(string resourceName, IList<string> validationErro...

Java Serialization with non serializable parts

I have: class MyClass extends MyClass2 implements Serializable { //... } In MyClass2 is a property that is not serializable. How can I serialize (and de-serialize) this object? Correction: MyClass2 is, of course, not an interface but a class. ...

What are the relative advantages of XMLEncoder and XStream?

Suppose I want to store many small configuration objects in XML, and I don't care too much about the format. The XMLDecoder class built into the JDK would work, and from what I hear, XStream works in a similar way. What are the advantages to each library? ...