serialization

XmlArrayItem deserialization error with nested items

I am totally new to serialization and would greatly appreciate any help. I am having problems deserializing the response message I receive from the proxy class I created through WSDL.exe. I believe the problem lies in the fact that I am using XmlArrayItem, which has nested items within. Instead of getting: <results xmlns="urn:partner...

Type 'System.Web.HttpInputStream' cannot be serialized.

Hi. I have been trying to design a WCF file upload service and am getting the following error in my web application: Type 'System.Web.HttpInputStream' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribut...

object serialization in PHP (using __sleep)

I am having a difficult time getting object serialization to work properly. According to the documentation, I need to return an array of the variable names I want to serialize from the __sleep function. I did this, but as you can see from the first line of the output, my 50 is nowhere to be found. And when I attempt to unserialize that, ...

How To Serialize SAP Business Objects?

First I have to clarify that I'm not referring to the company Business Objects recently acquired by SAP. Instead I'm referring to business objects as defined in the SAP Business Object Repository (BOR), e.g. SalesOrder (BUS2032). So what would be the preferred approach to serialize such a business object in the SAP system so that a thir...

PHP Class and inheritance, serialization

Hi! Serialized varibale does not seem to retain its state from classes that were extended. I have a class, called directly from somewhere that accepts a serialized variable: class Main extends Admin { function __construct($serialized){ parent::__construct($serialized); } .... (omitted) } class Admin extends Page{ var $pagearg...

[Android] How do I preserve a complex object across Activity restarts?

Say I have a Java Bean object which is serializable. I want to store it away safely when an Activity goes through onDestroy() on purpose (i.e. onSaveInstanceState() is not called). I am looking for a way which doesn't involve creating a database and write the object to that (mostly since a) Android's DB API is horrible and b) since data...

How to change the order of Deserialization using BinaryFormatter in C#?

Lets say I have classA which contains classB and both are [Serializable]. I assumed, that on Deserialization classB would be deserialized first. This is not the case however, as I could confirm by just logging when each [OnDeserialized] methods were hit. Now I have the following issue: After classA's deserialization is complete, it i...

jQuery Object Serialization

If I've for example an object like: {start: 1, end: 2, someString="someStringValue"} Is there any simple way to serialize it into a string of data? Example: start=1&end=2&someString=someStringValue Thanks. ...

Boost deserialization of contained object fails when performed from a constructor, but succeeds otherwise.

Boost deserialization of contained object fails when performed from a constructor, but succeeds otherwise. E.G.: ContainingClass::ContainingClass() { pNA = new objectArray*[NUMBER]; // allocates ptrs // ... pNA[ii] = new objectArray(SIZE);// allocates object array, and object array // has...

Are Linq to sql objects serializable for session state?

Without going into whether this is a good or bad idea: Is it possible to store a LINQ-to-SQL domain object in the ASP.NET Session, when the session is out-of-process? [EDIT] I'm currently getting the following error and asked this question because I suspect the LINQ-to-SQL objects: Unable to serialize the session state. In 'StateServe...

How do I add an XML attribute using DataContract

Hi I have a simple class I'm serializing. [DataContract(Name = "Test", Namespace = "")] public class Test { [DataMember(Order = 0, Name = "Text")] public string Text { get; set; } public Test() {} } This kicks out the following XML: <Test> <Text>Text here</Text> </Test> What I want is: <Test> <Text type="My...

Forbidden characters in xml

I have an object that I am serializing to xml. It appears that a value in one of the properties contains the hex character 0x1E. I've tried setting The Encoding property of XmlWriterSettings to both "utf-16" and "unicode" but I still get an exception thrown: here was an error generating the XML document. ---> System.InvalidOperationEx...

XML file with imbedded image data or ZIP file with XML + separate image files

I need to make a file format for my software. The data is basic key/value pairs and images. The options are: 1) One XML file that has CDATA tag with binary encoded image files or image files encoded in a RGBRGBRGB or RGBARGBARGBA format. 2) One XML file holding key/value pairs and links to image files. These image files would be packag...

DataContractSerializer does not properly deserialize, values for methods in object are missing

My SomeClass [Serializable] [DataContract(Namespace = "")] public class SomeClass { [DataMember] public string FirstName { get; set; } [DataMember] public string LastName { get; set; } [DataMember] private IDictionary<long, string> customValues; public IDictionary<long, str...

Why won't Rails deserialize my field?

I am using the Classifier:Bayes as part of a model class. I have the class set up to serialize the classifier to the db. class Foo < ActiveRecord::Base serialize :classifier end The yaml appears in the db just fine after doing some training and saving the object. But when I query for the class, instance.classifier is a string @f...

Serialization/Deserialization of a struct to a char* in C

I have a struct struct Packet { int senderId; int sequenceNumber; char data[MaxDataSize]; char* Serialize() { char *message = new char[MaxMailSize]; message[0] = senderId; message[1] = sequenceNumber; for (unsigned i=0;i<MaxDataSize;i++) message[i+2] = data[i]; return ...

Spring Transaction with Sybase

I am using Spring in my Web Application , with the underlying database as Sybase. I have 3 complex stored procedures to be executed. The procs , have create table and drop table commands to hold temporary result sets. The tables are created in the user db space , rather that in the tempdb space. Hence, I am faced with the need to ensu...

Object serialization duplicating nodes

Can anyone tell me why my output is duplicating the 'FirstNode'? using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Xml.Serialization; class Program { static void Main(string[] args) { Root root = new Root(); FirstNode firstNode = new FirstNode(); firstNode....

Random-access data object in J2ME

Hello, I'm planning to develop a small J2ME utility for viewing local public transport schedules using a mobile phone. The data part for those is mostly a big bunch of numbers representing the times when the buses arrive or leave. What I'm trying to figure out is what is the best way to store that data. The representation needs to be...

How do I convert PHP variables to JavaScript variables?

I am trying to insert php variables into javascript. Here is the broken code: var tokens = [<? $result = mysql_query("SELECT * FROM accounts ORDER BY id DESC") or die (mysql_error()); while ($row = mysql_fetch_array($result)) { $user_name = $row['user']; $user_id = $row['id']; echo "['$user_name','$user_id'],"; } ?>] ...