serialization

Deserializing XML to Objects in C#

So I have xml that looks like this: <todo-list> <id type="integer">#{id}</id> <name>#{name}</name> <description>#{description}</description> <project-id type="integer">#{project_id}</project-id> <milestone-id type="integer">#{milestone_id}</milestone-id> <position type="integer">#{position}</position> <!-- if user can see...

Class design for serialization - ideas or patterns?

Let me begin with an illustrative example (assume the implementation is in a statically typed language such as Java or C#). Say you are building a content management system (CMS) or something similar. The data is hierarchically organised into Folders. Each folder has a collection of children; a child may be a Page or a Folder. All items...

Enhancing Profile Provider

Hi, I am want to serialize and array object for a custom wizard I am writing but I am having difficulties doing this. Can someone help this is the error and code snippets I am using. The error I believe has to do with not being able to convert the array. namespace Helios.Web.Framework { /// <summary> /// Summary description fo...

How to serialize in c++ ?

Using java for 3 years and serialization / deserialization is something trivial. I would like to know whether c + + is also well? It is possible to serialize / deserialize a class in c + +? If someone can leave me an example would be a great help to me. EDIT : There are some native library that allows this? ...

How to unit test if my object is really serializable?

I am using C# 2.0 with Nunit Test. I have some object that needs to be serialized. These objects are quite complex (inheritance at different levels and contains a lot of objects, events and delegates). How can I create a Unit Test to be sure that my object is safely serializable? ...

Flex cannot deserialize webservice element that contains only attributes

I'm seeing a very strange issue with a .NET webservice being consumed by Flex. I have a very simple class with nothing other than properties with [XmlAttribute('xxx')] attributes. public class OrderAddress { public OrderAddress() {} [XmlAttribute("firstName")] public string FirstName { get; set; } [XmlAttribute("lastN...

How do I get my dependenices inject using @Configurable in conjunction with readResolve()

The framework I am developing for my application relies very heavily on dynamically generated domain objects. I recently started using Spring WebFlow and now need to be able to serialize my domain objects that will be kept in flow scope. I have done a bit of research and figured out that I can use writeReplace() and readResolve(). The ...

Which is the best alternative for Java Serialization?

I'm currently working on a project which needs to persist any kind of objects (of which implementation we don't have any control) so these objects could be recovered afterwards. We can't implement a ORM because we can't restrict the users of our library at development time. Our first alternative was to serialize it with the Java defau...

creating objects dynamically in C++

I was just reading this thread and it occurred to me that there is one seemingly-valid use of that pattern the OP is asking about. I know I've used it before to implement dynamic creation of objects. As far as I know, there is no better solution in C++, but I was wondering if any gurus out there know of a better way. Generally, I run ...

How the heck can you edit valid XML in a webpage?

I've got to get a quick and dirty configuration editor up and running. The flow goes something like this: configuration (POCOs on server) are serialized to XML. The XML is well formed at this point. The configuration is sent to the web server in XElements. On the web server, the XML (Yes, ALL OF IT) is dumped into a textarea for editin...

Homemade vs. Java Serialization

I have a certain POJO which needs to be persisted on a database, current design specifies its field as a single string column, and adding additional fields to the table is not an option. Meaning, the objects need to be serialized in some way. So just for the basic implementation I went and designed my own serialized form of the object w...

YAML serialization library for C++?

YAML seems like a great format for configuration files & data binding persistent objects in human-readable form... Is there a C++ library that handles YAML? Does Boost::Serialization have plans for a YAML option? EDIT: I would prefer an OO library. ...

.NET: How to know when serialization is completed?

When I construct my control (which inherits DataGrid), I add specific rows and columns. This works great at design time. Unfortunately, at runtime I add my rows and columns in the same constructor, but then the DataGrid is serialized (after the constructor runs) adding more rows and columns. After serialization is complete, I need to cl...

Serialize a nullable int

I have a class with a nullable int? datatype set to serialize as an xml element. Is there any way to set it up so the xml serialializer will not serialize the element if the value is null? I've tried to add the [System.Xml.Serialization.XmlElement(IsNullable=false)] attribute, but I get a runtime serialization exception saying there ...

How to (de)serialise JSON data in Silverlight using a different name to member variable

I have the following members defined in a class that I'm trying to deserialise: [DataMemberAttribute(Name = "cust_title")] public String Title { get; set; } [DataMemberAttribute(Name = "cust_description")] public String Description { get; set; } For some reason, the deserialisation fails (it seems to ignore the DataMemb...

I'm somewhat confused about the serialization of a PHP associative array.

a:3:{i:0;i:4;i:1;i:3;i:2;i:2;} Am I right to say that this is an array of size 3 where the key value pairs are 0->4, 1->3, and 2->2? If so, I find this representation awfully confusing. At first, I thought it was a listing of values (or the array contained {0, 4, 1, 3, 2, 2}), but I figured that the a:3: was the size of the array. And i...

How to convert DateTime from JSON to C#?

I've got the following class: [DataContractAttribute] public class TestClass { [DataMemberAttribute] public DateTime MyDateTime { get; set; } } Here's the JSON: { "MyDateTime":"1221818565" } The JSON is being returned from a PHP webservice. What I need to do, is convert that epoch string into a valid C# DateTime. What's the be...

.NET base type cannot be serialized by WCF

I'm writing a WCF service and want to expose some custom configuration elements (e.g. Custom ConfigurationSection and ConnectionStringSettings) so that I can modify the service's configuration. One of my custom configuration elements inherits from System.Configuration.ConfigurationElementCollection. When I try to start my WCF service I g...

Serializing Name/Value Pairs in a Custom Object via Web Service

This is a very complicated question concerning how to serialize data via a web service call, when the data is not-strongly typed. I'll try to lay it out as best possible. Sample Storage Object: [Serializable] public class StorageObject { public string Name { get; set; } public string Birthday { get; set; } public List<NameValueP...

How can I profile serialization overhead in my application

My application has a WCF service tier between the front-end and the database. Since we currently host in IIS6 we are using SOAP over HTTP. How can I find out how much real world time I am spending doing serialization activities in my application? ...