serialization

How to serialize DOM node to JSON?

I want to serialize DOM node or even whole window to JSON. For example: >> serialize(document) -> { "URL": "http://stackoverflow.com/posts/2303713", "body": { "aLink": "", "attributes": [ "getNamedItem": "function getNamedItem() { [native code] }", ... ], ... "ownerDocument": "#" // recursive link he...

Is it safe to use boost serialization to serialize objects in C++ to a binary format for use over a socket?

I know that you can use boost serialization to serialize to a text format and then push over a socket, but I'd like to serialize a class of statistics data into a binary format (both for size and encoding/decoding overhead reasons). Is it safe to use boost serialization for this? My specific worries are: Differences between intege...

How do you use XMLSerialize for Enum typed properties in c#?

I have simple enum, enum simple { one, two, three }, and I have a class that has a property of type simple. I tried decorating it with the attribute: [XmlAttribute(DataType = "int")], but when I try to serialize it using an XmlWriter, it fails. WHat is the proper way to do this? Do I have to mark the enum itself as well as the property, ...

Why is BinaryFormatter trying to serialize an Event on a Serializable class?

I have a simple class that is marked as Serializable, and it happens to have an event. I tried to mark the event member as NonSerialized, however the compiler complains. Yet when I go to serialize the class instance, the BinaryFormatter throws an exception that the event is non serializable. Does that mean you can't serialize classes tha...

Manual object serialization in Java.

I have a custom INIFile class that I've written that read/write INI files containing fields under a header. I have several classes that I want to serialize using this class, but I'm kind of confused as to the best way to go about doing it. I've considered two possible approaches. Method 1: Define an Interface like ObjectPersistent enfor...

Should I use Json or Xml in Silverlight

I'm communicating with several services from a SL component using both TCP sockets & HTTP web requests and we are discussing what (data) format to use - JSON or XML. I'm wondering what others have choosen and why? Cheers AWC ...

Generics + XML Serialization + Custom Objects

I'm trying out Generics and I had this (not so) great idea of creating an XMLSerializer class. The code I pieced together is below: public class Persist<T> { private string _path; public Persist(string path) { this._path = path; } public void save(T objectToSave) { XmlSerializer s = new XmlSerializer(...

What happens behind the scenes during deserialization of a NameValueCollection?

What's going on behind the scenes in .NET (de)serialization that makes it behave the way it does in the following scenario? (This is a test app that just illustrates my setup.) I have a class with a NameValueCollection property: [Serializable] public class MyClassWithNVC { public NameValueCollection NVC { get; set; } } It, in tur...

Passing Exception as a part of response in WCF

Hi, I have somewhat unconventional use of exceptions in my app. If an exception happens in the method, I pass it as a part of the result object, smth like this: pubic class MethodResponse { public List<Exception> Errors {get; set;} public int SomeResult {get; set;} } Now, I'm separating Business layer and UI layer using WCF, and ...

Could not find file "C:\WINDOWS\TEMP\xxxx.dll

Hi All, I know this question has been asked many times and I have done some extensive research on the internet to try and resolve the issue but everything I have tried has failed and I really need to sort this issue out, hence my post. Here is what I have tried: Change the directory in which the temp files are stored. (Changed locally...

Could not Deserialize JSON Object

We are trying to consume WCF service which returns employee details in JSON Format. like: {"d":[{"_type":"Employee:#","BigThumbNailURI":null,"ID":1,"Name":"E1"},{"_type":"Employee:#","BigThumbNailURI":null,"ID":2,"Name":"E1"}]} From VB.net code behind when I am trying to deserialize it it's stating that "Expecting state 'Element'.. E...

Alternative to being able to define static extension methods

I understand that I can't extend static classes in C#, I don't really understand the reason why, but I do understand that it can't be done. So, with that in mind, here is what I wanted to achieve: public static class GenericXmlSerialisationExtender { public static void WriteToXML<T>(this T targetObject, string fileName) { ...

Help with unserialized var dump

I have a var dump of unserialized data that looks like this array(3) { ["product_options"]=> array(1) { [594]=> string(4) "2497" } ["is_edp"]=> string(0) "" ["base_price"]=> float(17.99) } Can anyone help me get the data out of this array. I specifically need to access the [594] and get it to print out 2497. Any solutions or advi...

Is there a JSON serializer in the Silverlight

I really want this so I can serialize / deserialize some complex data objects using JSON. ...

ObjectInputStream: is this correct way to unblock

ObjectInputStream blocks when created until it recieves a serial input stream ans verifies it. I was trying to make my first program using sockets through it and found this. I used a dummy object so that it doesn't block. The code is here: import java.io.*; import java.net.*; import java.util.*...

Can i deserialize object back to original interface even if all the concrete types now reference new version of interface

Hello Guys, I am running into this massive problem, I have to for various reasons change the Interface defintion to something different. This interface was serialised as a blob into the database. Now i am trying to do the migration of old blob into new blob . But i have managed to maintain the original contract defintion side by side to...

WCF - probem with serializing inherited types

I have these classes: [DataContract] public class ErrorBase {} [DataContract] public class FileMissingError: ErrorBase {} [DataContract] public class ResponseFileInquiry { [DataMember] public List<ErrorBase> errors {get;set;}; } An instance of the class ResponseFileInquiry is what my service method returns to the client. Now, if...

Ignore binary serialization on a property

I have a regular C# POCO. At the class level, I am decorating the object with [Serializable()]. That said, I am using the Linq Sum() on one of the properties and I am receiving an error upon serialization. If possible, I would like to just simply ignore this property. However, the [XmlIgnore()] is only for Xml Serialization, not Bina...

Do .NET 3/4 Permits Events to be Binary De/Serialized?

In .NET (at least <=2) there's a problem serializing objects that raise events when those events are handled by a non-serializable object (like a Windows Form). Because of the way VB.NET implements events, when you serialize an object, its events get serialized too (because events are actually implemented using hidden multicast delegate...

Deserialized bean needs scoped dependencies

How can I inject dependencies into a deserialized bean? Some of my Spring beans should be serialized during the render-response phase of our JSF application, and then deserialized at the beginning of the next request. Some of those beans have dependencies which are scoped to the request. If I configure the dependencies with the scoped...