serialization

WCF REST Debugging

How can I log what xml is sent to my WCF REST service prior to being deserialized into my datacontract class? ...

Testing that serializable attributes are set

I'm writing a unit test to verify that the serializable attributes are set on my class. I thought I was on the right way, but for some reason I can't find the attribute types. Here is my class: [DataContract] public class User { [DataMember] public int Id { get; set; } } And a unit test for checking the attributes: [Test]...

.net Serialization XML namespace inside namespace

Hi. I want to generate an XML like this: <a:foo> <b:bar><b:value="test" /></b:bar> </a:foo> I'm generating an XML from a class descriptor. I have this: [Serializable] [XmlType(Namespace = Constants.NS_A)] [XmlRoot("Foo", Namespace = Constants.NS_A, IsNullable = false)] public class Foo { private Bar_ bar = new Bar_(); [XmlEl...

Any advice regarding a hexagonal architecture with serialization as the primary metaphor?

I've got the opportunity to rewrite the core of an internally-developed application that my employer uses for document control. My "core" requirements list goes something like this: Make it easier to import/export to various formats (collection of files + fairly extensive metadata being the common factor) Make it easier to add new fie...

.NET XML Serialization and Null Collections

I have a class with some collections in them, and I would like to serialize instances of this class to XML without having to initialize the collections to be empty, and without having to implement IXmlSerializable. I don't care if it creates empty elements, or doesn't create the elements at all. Just that it works without having to ini...

I need a special serializer (C#)

Hey everyone, I am looking for a serializer that will match my requirements, the serializer can be in the .Net framework, an Open-Sorce or a pay-for product (as long as it can b used directly from the code). now, my requirements are these: mandatory Able to handle a cyclic reference. Automatic, usues either attribute or inheritance ...

serialize form in jquery after elements adding

Hi! I'm dynamic add some inputs to my form by changing html() of some divs located in form. When i'm them serialaze this form inserted inputs doesn't serialized. what can i do? ...

Xstream/HTTP service

We run multiple websites which use the same rich functional backend running as a library. The backend is comprised of multiple components with a lot of objects shared between them. Now, we need to separate a stateless rule execution component into a different container for security reasons. It would be great if I could have access to a...

Is this possible to write a Marker interface

I have gone through the following tutorial : http://www.javaworld.com/community/node/2915 And after reading the above article, I feel, that it is not possible to write a Marker interface, because, how can you instruct compiler, that, what tag, it embed in the .class file for your Marker interface. Please correct me, if I am wrong. che...

.net XMLSerializer multiple namespace problem

Hi, I've got a problem using the .net XMLSerializer object and XML namespaces. My experience of the the XMLSerializer is very limited and I haven't worked with XML much before. I'm trying to something like the following: <Record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; <Property1>blah</Property1> <oai_dc:dc xmlns...

Django: serializing list to json

I am sending information between client and django server and I would like to use json to this. I am sending simple information - list of strings. I tried using django.core.serializers, but when I did, I got AttributeError: 'str' object has no attribute '_meta' It seems, this can be used only for django objects. How can I serialize si...

VB.NET difficulties serializing classes with attached events.

Surprised this question has not been asked yet here, but here goes: Serialization in VB.NET is a bit of a pain. If you use the standard Serializable() attribute, and attempt to serialize a class that has events which are attached to handlers, it will attempt to serialize the handlers as well. Coming from a C# background I am not used t...

Deserializing difficultly formed XML to C# object

I have XML that is returned by a 3rd party web service in the following form: <object> <list name="subscriptions"> <object> <string name="id">something</string> <string name="title">something else</string> <list name="categories" /> <number name="timestamp">1252707770116</nu...

Serializing ENUM Singleton

I'm trying to serialize an ENUM singleton instance (as described by Joshua Bloch in his book Effective Java) to a file. The ENUM instance is a simple JavaBean as this: public enum ElvisFan implements Serializable{ INSTANCE; private int totalSongsListened; private ElvisFan(){ totalSongsListened=0; } public void set(int v){ ...

Null reference exceptions during Base64 deserialization (C#)

I am using the following methods to serialize and deserialize .NET objects: public static string SerializeToBase64(object data) { var stream = new MemoryStream(); var formatter = new BinaryFormatter(); formatter.Serialize(stream, data); stream.Position = 0; return Convert.ToBase64String(stream.ToArray()); } public s...

adding datalist into viewstate

I have added one datalist into view state as: ViewState["datalist"] = dtlstForm; and retrieved it as: DataList lis = (DataList)ViewState["datalist"]; then folowing error comes: Type 'System.Web.UI.WebControls.DataList' in Assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as seri...

How to encode (serialize) and decode (deserialize) AMF packets?

Hi, At the moment it seems I've tried every trick in the book trying to get this to work. I need some way of encoding AMF requests and then decoding the responses. At this point I don't care what language it's in, as long as it's doable and free (as in to me), however I would prefer PHP. I don't know what other information is needed, b...

Is it possible to deserialize xml to List object using .net provided serialization attributes?

I have xml input which looks like (simplified version used for example): <Student> <Subject> History </Subject> <Subject> English </Subject> </Student> Is there a way to get the above xml deserialized to a object whose class looks like: [Serializable] [XmlRoot(ElementName = "Student", Namespace="")] class Student { public Student()...

DataContractSerializer and List(Of Exception)

How can I serialize a list of Exception objects (also including derived exceptions, eg. FileNotFoundException) with the DataContractSerializer? I always get an error about the serializer not knowing the types in the list so i devised a workaround. It looked something like this: Dim XmlSerializer As New DataContractSerializer(Excep...

How to serialize a class that contains objects of other classes (recursive serializing?)

How can I do this? Or will the serializer automatically go with recursion, and serialize all those child objects into XML? Give me an example how would you serialize classes that contain other classes' objects in themselves! That was the core of this question! I've tried this, and it didn't output anything (except the XML header) to th...