xml-serialization

XML Serialization and a Class with Binary Property - How can I get this to work?

I have the following serialization method shown below. The problem is that I am attempting to pass a class to it that contains a property of type Binary. The serialization is failing because of this property type. Is there any way I can serialize a class with a property of type Binary? private string Serialize<TEntity>(TEntity insta...

XML Serialization issue in ActiveRecord serializable attributes.

I have a serialized field called options(of type Hash) in my User model. The options field behaves like a Hash most of the time. When I convert the user object to XML, the 'options' field is serialized as a YAML type instead of Hash. I am sending the result to a Flash client via REST. This behaviour is causing problems at the client si...

serialize object to xml problems

I am having trouble serializing an object to xml. I have one class that serializs fine: public class GlobalInfo { public string Ripper = ""; public string Lineage = ""; } I have the code that serializes it here (GlobalInfoData is an instance of GlobalInfo class above) System.Xml.Serialization.XmlSerializer x = ne...

XML serializing arrays with type="array" in .NET

I'm attempting to serialize a class to XML, but I have some strict requirements on the output (because I want Rails' ActiveResource to consume it). One of those requirements is specifically for arrays. Here's two examples: class Person { public string FirstName { get; set; } } List<Person> people = new List<Person>(); people.Add( new...

Serialization for document storage

I write a desktop application that can open / edit / save documents. Those documents are described by several objects of different types that store references to each other. Of course there is a Document class that that serves as the root of this data structure. The question is how to save this document model into a file. What I need:...

Java: Serialization/ Deserialization to/from XML instead of binary

I have a complex set of data models that currently implement java.io.Serializable, and I have successfully serialized and deserialized them with ObjectOutputStream and ObjectInputStream. However, the result are binary files (as expected), and I was wondering if Java supports serialization and deserialization in the same manner to a non-...

WCF - Stream parameter is missing CR of CRLF

The problem I have is that the client is sending me a string of data as a stream. WCF then normalizes (removes the CR part of CRLF) and I get a hash mismatch between server and client on that specific string. public void SomeWcfContract(Stream input) { try { string processed = ReadStream(input); ...

Convert an org.w3c.dom.Node into a String

Hi, Sorry I'm a Java/XML newbie - and can't seem to figure this one out. It seems it's possible to convert a Document object to a string. However, I want to convert a Node object into a string. I am using org.ccil.cowan.tagsoup Parser for my purpose. I'm retrieving the Node by something like... parser = new org.ccil.cowan.tagsoup.Par...

help me "dry" out this .net XML serialization code

I have a base collection class and a child collection class, each of which are serializable. In a test, I discovered that simply having the child class's ReadXml method call base.ReadXml resulted in an InvalidCastException later on. First, here's the class structure: Base Class // Collection of Row objects [Serializable] [XmlRoot("Ro...

Why doesn't boost::serialization check for tag names in XML archives?

I'm starting to use boost::serialization on XML archives. I can produce and read data, but when I hand-modify the XML and interchange two tags, it "fails to fail" (i.e. it proceeds happily). Here's a small, self-complete example showing what I see: #include <iostream> #include <fstream> #include <boost/archive/xml_oarchive.hpp> #includ...

XML-Serializing delegates

I have a class that I want to be serializable but contains a public instance of delegate that, apparently can't be serialized: <Serializable()> Class A Public Delegate Function TestEventHandler(ByVal myObj as CutomObject, _ ByVal myObj2 as CustomObject) as Boolean ' does not 'want' to be...

LinkedList<T> can not be serialized using the XMLSerializer

A LinkedList can't be serialized using XmlSerializer. Now, how to however save/retrieve data from a serialized objet LinkedList. Should I implement custom serialization? What I tried to do: using System.Xml.Serialization; [Serializable()] public class TestClass {     private int _Id;     private string _Name; private int _Age; ...

XML-schema/validation: different separator for datatype double

hey, I changed the datatype of some parameters within my xsd file from string to their real type, in this case double. now I'm facing the problem that around here the comma is used as a separator and not the point as defined by the w3 (http://www.w3.org/TR/xmlschema-2/#double) causing erros all over during deserialization (C#, VS2008). ...

how to use XmlAttributeOverrides when serializing an array?

I have an array called _updatedComponents of objects that are of class NetworkComponent. I have to serialize it in the way that the name and namespace of the root element (=array) is changed and individual NetworkComponent-item's name is changed to component. I have a code below that causes an enception: System.InvalidOperationException...

Serialize XML file in AS3

How can I serialize XML(meaning convert < to &lt; and > to &gt; etc...) using AS3. is there any build-in functionality or I have to use some regular expression to make global changes? Any Suggestions? ...

How to override xml element name for collection elements using XmlAttributeOverrides?

I've got a very basic object object model that is being serialized by the System.Xml.XmlSerialization stuff. I need to use the XmlAttributeOverrides functionality to set the xml element names for a collection of child elements. public class Foo{ public List Bars {get; set; } } public class Bar { public string Widget {get; set; } } ...

Help with XSD element having references to other elements but don't want things nested.

I have a XSD file I'm using to generate JAXB classes for a RESTful API I am working on. I have two classes. An Appointment and a Person. A Person has an Appointment. I'd like to end up with XML like this: <Appointment> <Person id="12345">Billy Bob</Person> ... </Appointment> So, that on the far end I an just fetch Person if...

How to include multiple XML files in a single XML file for deserialization by XmlSerializer in .NET

Hi, is it possible to use the XmlSerializer in .NET to load an XML file which includes other XML files? And how? This, in order to share XML state easily in two "parent" XML files, e.g. AB and BC in below. Example: using System; using System.IO; using System.Xml.Serialization; namespace XmlSerializerMultipleFilesTest { [Serializ...

Prevent <xsi:nil="true"> on Nullable Value Types when Serializing to XML.

I have added some nullable value types to my serializable class. I perform a serialization using XmlSerializer but when the value is set to null, I get an empty node with xsi:nil="true". This is the correct behaviour as I have found here: http://msdn.microsoft.com/en-us/library/ybce7f69%28VS.80%29.aspx Is there a way to switch off thi...

Accessing Child nodes during Xml Serialization

How can I access the children of the Name Element during Serialization <Person> <Name> <First>John</First> <Middle>Adam</Middle> <Last>Smith</Last> <Madian></Madian> </Name> <Gender>M</Gender> </Person> [XmlRootAttribute("Person", IsNullable= false)] public class Person { [XmlElement(Elem...