serialization

Problem deserializing validated XML, can't convert to/from array

I'm a bit out of my element. I've used xsd.exe to create an xsd schema from an xml file, and then to create a C# class from that xsd. That all seems to work fine. At the moment I'm just trying to get the XML deserialized. The file I'm deserializing if the very same file I used to build the class originally. Here's my code: String xsdPa...

How to Serialize Multiple Objects of the SAme Class into a single file and Deseialze into Those objects in c#

How to serialize Multiple Objects of the same Class into a single file and Deserialze into Those objects in c# ...

Serialize Struct in Binary, Packed Format

Is there a way in C# to serialize a struct to a binary stream (MemoryStream) such that the binary representation is equivalent to how the struct is visually layed out (i.e. no padding)? In C/C++, you use #pragma commands to tell the compiler to pack the struct's so that there is no padding between the fields. This is helpful if you hav...

What is the difference between Serializable and Externalizable in Java?

What is the difference between Serializable and Externalizable in Java? ...

Save NSMutableArray to disk

Hello, I have an NSMutableArray that holds objects of the type Person (NSString,NSString,int) I am looking for a easy way to save this array to disc and load it again later. I read alot about serialization but I never have done that. Maybe it's not the easiest way for me after all. ...

Silverlight serialization of a .NET Web service causes XML error

I've got this class being provided by a web service that is then being consumed by a Silverlight app (I don't know if that's relevant or not) [Serializable] public class Entry { private string _title; public string Id { get; set; } public string Title { get { return _title; } set { _title = value; } } public string Link { get; set;...

How can I serialize an object that has an interface as a property?

I have 2 interfaces IA and IB. public interface IA { IB InterfaceB { get; set; } } public interface IB { IA InterfaceA { get; set; } void SetIA(IA value); } Each interfaces references the other. I am trying to serialize ClassA as defined below. [Serializable] public class ClassA : IA { public IB InterfaceB { ge...

Using C# to serialize a Java deserializable object

I have two application that need to talk to each other. App1 needs to be able to serialize an object that App2 can then deserialize. Easily done, right? Here's the problem; App1 is C# based, App2 is Java based. So App1 needs to write out the file in the Java binary file format. How can this be done? The way I see it, I have two options....

Not Serializable Exception

i am trying to create a mock shopping cart for a uni project. im using two java classes Item and shoppingCart, shopping cart uses a vector to store Items and then writes them to a file. i am trying to use the classes on a jsp page but when i try to write to the file i get an java.io.WriteAbortedException: writing aborted; java.io.NotSeri...

how to remove default xmlns entries when serializing a class

I've instantiated a class that is serializable, and I'm serializing it to a file, but it is always putting the following attributes in my root element: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" How can I stop that? ...

Python - Save the context

Hi to all, I need to save the context of the program before exiting ... I've put all the needed stuff to an object that I've previously created a I tried many times to picke it, but no way !! I continuously have errors like : PicklingError: Can't pickle 'SRE_Match' object: <_sre.SRE_Match object at 0x2a969cd9c0> OSError: [Errno 1] Oper...

If I implement ISerializable in a child class, does the parent have to as well?

I have to implement ISerializable in a derived class (to do some custom serialization/deserialization) but the parent class is marked as [Serializable]. The serialization "works" (I can serialize and deserialize without runtime errors) but it looks like the base class data isn't being preserved. Is the fact that I'm implementing GetObj...

How could an object get a reference to a class that is in a different (and unreferenced) assembly?

I have two projects: A/B. Project A is the project that contains all of the winforms which are bound to objbects in B (logic items) A has an object of type A.Form B has objects of type B.Serializer B.Logic Now, A has a reference to B (but B does not have a reference to A) and A.Form contains a member variable of type B.Logic. At some...

Exception when serializing WPF contols

I have an Application (an appointment manager) which lets the user create usercontrols in a stackpanel per button click and the user can enter data into the usercontrols. So far so good. I serialized the stackpanel with XamlWriter.Save(). But then when I try to load it again the next time the application starts with XamlReader.Load() I ...

Using JAXB to unmarshall elements with varying/dynamic names

I'm parsing an XML document that has nodes like the following: <objects> <dog> <data1>...</data1> <data2>...</data2> <data3>...</data3> </dog> <cat> <data1>...</data1> <data2>...</data2> <data3>...</data3> </cat> </objects> The elements data1, data2, data3 are always consistent. Only the parent tag vari...

In XStream is there a better way to marshall/unmarshall List<Object>'s in JSON and Java

I'm using XStream and JETTISON's Stax JSON serializer to send/receive messages to/from JSON javascripts clients and Java web applications. I want to be able to create a list of objects to send to the server and be properly marshalled into Java but the format that XStream and JSON expect it in is very non-intuitive and requires our javas...

Protocol Buffers: Should I use int64 or fixed64 to represent a .NET DateTime value?

I need to serialize a .NET DateTime value in a protocol buffers message. My plan is to use the DateTime.ToBinary() and then pass the 64-bit returned value in the message. But I'm not sure what to choose as a protocol buffers data type to represent that. I guess I'm confused about when the fixed64 (or sfixed64) data types should be use...

How to serialize a generic JavaScript object to XML

Does one of the mainstream JavaScript libraries (YUI, jQuery, Dojo) provide a way to serialize a JavaScript object to XML (as text)? ...

How can I persist a class to a single column using NHibernate

I'm looking to persist an object to a single column using NHibernate. I'd like to serialize the data on the way in into a single column, and then deserialize it on the way out. This could be binary or xml. How can I go about doing this? ...

XML Deserialization of a date with an empty value

I'm getting a xml file from one vendor that has some "empty" dates like this: <UpdatedOn/> <DeletedOn/> By doing a regular deserialization it fails with: Inner Exception: System.FormatException: String was not recognized as a valid DateTime. Any ideas how to deal with this ? My fields are already marked for a default DateTime: ...