serialization

Java Serialization Comparator

Hello, Is it possible to serialize a TreeMap with a comparator?? I've tested and it serializes well a treemap without comparator, when you add the comparator, it throws an exception. If I declare comparator as transient, it still doesn't work. It only works if I make every tree map transient but it doesnt serialize the trees in that c...

Recommended approach for linq to sql serialization for simple json and mvc

I have cascading drop down lists in a .net mvc view and am using JQuery onchange to pull the next drop down list using a json response. The problem comes in where iI get a circular reference when trying to serialize the linq to sql response. I understand why it is happening, its because I have the buyer -> contracts and contract -> b...

How to forget serialized data after read in Java?

I'm making a program that opens a previous saved file through serialization and want to create a new one, however, data stays in. How can I make the program forget the data? ...

Calling equals on an ArrayList After Serialization

I am hitting a strange problem in relation to equals on an object transported over RMI. This has been wrecking my head for a few days now and I was wondering if anyone can help shed some light on the Problem. I have a Garage Class (that is also a JPA entity in case its relevant) that I push to a java process called X over RMI (So this o...

Exporting WSDL/XSD schemas for data contract types with IXmlSerializable

I'm creating a WCF service which I want to consume from a Java app. But the question isn't about .net-java interop. The key point is one of types related to a service operation is IXmlSerializable. That type return its XSD schema with static method referenced by XmlSchemaProviderAttribute. The problem is when we get wsdl for the service...

How to deserialize xml when root declare namespaces?

I have xml: <?xml version="1.0" encoding="UTF-8"?> <wnio:Dokument xmlns:wnio="http://crd.gov.pl/wzor/2009/03/31/119/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ... > </wnio:Dokument> I want to deserialize it to object, for example: [Serializable()] [XmlRoot(Namespace = "wnio")] public class Dokument { ... } What paramet...

How to change endianness when unmarshalling a CDR stream containing valuetype objects in Java.

I've got marshaled CDR data all by itself in the form of a file (i.e., not packed in a GIOP message) which I need to unmarshal and display on the screen. I get to know what type the data is and have working code to do this successfully by the following: ValueFactory myFactory = (ValueFactory)myConstructor.newInstance( objParam ); Stream...

Can a IFormatter deserizalize a object of an unreferenced type?

Supose I serialized a third party library type object with BinaryFormatter. An assemby that does not references this library tries to deserialize the bytes. Will it work? I do not expect to it be cast to the correct type, I just want to retrieve it as an object instance so I can group it and serialize it again. ...

xml- Deserialize

I am try to deserialize my class, that normally serialized. public class MyClass { private List<Section> sections = new List<Section>(); public List<Section> Sections { get { return this.sections; } } } public class Section1: Section { public string MyProperty {get;set;} } public class...

Good way to get size of class for binary serialization

I'm writing some classes that are going to be used to communicate with a C# TCP server, and I'm writing serialization/deserialization methods using BinaryWriter and BinaryReader. This is easy enough, but I've run into a situation where I have a class Class1 that contains an instance Class2 inside. Both classes implement an interface that...

C++ Declarative Parsing Serialization

Looking at Java and C# they manage to do some wicked processing based on special languaged based anotation (forgive me if that is the incorrect name). In C++ we have two problems with this: 1) There is no way to annotate a class with type information that is accessable at runtime. 2) Parsing the source to generate stuff is way to compl...

.NET - Return a List<CustomSerializableObject> from a webservice

Is it a good idea to try and return a strongly typed List of custom objects from a webservice? Any pitfalls I should know about? [WebMethod] public List<CustomSerializableObject> GetList() { List<CustomSerializableObject> listToReturn = new List<CustomSerializableObject>(); listToReturn.Add(new CustomSerializableObject()); ...

Custom attribute to switch property serialization to NetDataContractSerializer

In .NET 3.5, I would like to create a custom attribute (say [NetDataMember]) that would switch the serialization behavior from DataContractSerializer to NetDataContractSerializer. Basically, for a class A as illustrated below [DataContract] class A { [DataMember] public int SimpleProperty { get; set; } [Transcient] public IBar...

JSON, JS to Java and Vice Versa, and other languages.

I want to use JSON to represent JS objects send them to a Java program, and vice versa. I would also like to do this for other languages. C# to Java maybe? What do I use to do this? (Not sure if it is refered to as serialization or data binding) Edit: Once a Java object is represented in JSON, does this mean that JavaScript can parse...

Apply IOperationBehavior override for plain serialization? (not service)

I would like to create an [CustomDataMember] attribute that override the formatter behavior of DataContractSerializer through an IOperationBehavior. I have followed the instructions given by Aaron Skonnard but when I call the DCS serializer, the custom behavior does not get neither instantiated nor called. Obviously, I am missing somet...

In PHP, why is json_encode way slower than serialize?

I don't get it, the data produced by json_encode is much more straightforward than serialize and yet both the JSON encode and decode functions are much more slower than the serialize and unserialize counterparts. Why? ...

C# Serialization of nested classes

Hi, I want to serialize an object. I've got this basic class structure: class Controller { Clock clock; public event EventHandler<ClockChangedEventArgs> ClockChanged; public void serializeProperties() { using (FileStream stream = new FileStream(PROPERTIES_FILE, FileMode.Append, FileAccess....

How to make a Java serialized object being passed over network notify client GUI of change.

I am making a client-server Java app that is going to be MV(C, P) like. My current problem is once the client get's a Player object it needs to tell the GUI that the Player was changed and it should update everything on GUI. (Not too detailed, so entire update shouldn't be bad) /* * ClientGUI.java * * Created on Dec 10, 2009, 7:51:3...

Service - client interface, architecture advice

Hi, I have a Windows WCF serivce and Web client. My service has one method [OperationContract] SubmitOrder(OrderInfo info).... // class used to pass all relevant data [DataContract] class OrderInfo { [DataMember] OrderType Type; // general order data } It was great until I have introduced new order types (controlled by OrderInfo....

WCF XML Serialization & Overloading

In my WCF service I only want 1 endpoint (1 URI), however, I want this URI to be able to handle multiple types of requests. 5 different request types can be sent to this service from another company. Each request has a unique XML schemas. I created classes for each XML request to be serialized. Normally I would just overload a function ...