xml-serialization

This XmlWriter does not support base64 encoded data

I have a class like this: public class Data { public string Name { get; set; } public int Size { get; set; } public string Value { get; set; } [NonSerialized] public byte[] Bytes; } When a List<Data> hits the serialization method below, it occasionally dies with InvalidOperationException "This XmlWriter does not...

How can I override deserialization in C#

I've got a class that will undergo certain version changes over the course of time. The data from inside this class is serialized and deserialized as part of the startup of my application. The problem I have is if I update the class by adding more properties, and then start the application, the old data does not get loaded properly. What...

IOException on Deserializeling XML

I am writing a small navigation app for Windows Mobile 6.1 (.NET CF 3.5), and I am getting IOException when I try to deserialize my data from file stream, and I cant understand why. here is some of my code: //That's the class I am trying to serialize / deserialize public class MapData { [XmlIgnore] public Bitmap Ent...

xml data text + binary

Hello all, I built iphone app that getting inforamtion from server(this is server that i built also). the data from the server is type XML and i use the xml parser to parse the message. what i want is to add image to be send from the server and i am asking if i cann add binary data such image to the xml message.for example 10 tags will b...

Using XML decorations to specify default values during de-serialization

I have a problem deserializing some XML; the XML supplied by a third party is quite verbose, so if there is no value set for an particular element, it will supply and empty element (e.g. <element1 />). This is a problem for certain elements, for example, those that are meant to store integers. I have control over the third party, so I c...

xmlSerializer.Serialize -is there a limit to the size of the collection that I can pass to it?

I am using vb.net v4 I have a serialize function: Public Function ListToXML(ByVal pObj As List(Of dcEventEngine.Event)) As String Dim xmlSerializer As New XmlSerializer(GetType(List(Of dcEventEngine.Event))) Dim strWriter As New StringWriter xmlSerializer.Serialize(strWriter, pObj) ...

Three XML formatting problems with .NET XmlSerializer

I've got three problems with some data that I'm serializing. First off, it outputs <?xml version="1.0" encoding="utf-8"?> but the program that I'm loading it into only wants <?xml version="1.0"?> Secondly, whenever the data is empty it will use shorthand for closing the tag (<z303-profile />) but the program that I'm loading it into ...

Polymorphic element typenames using XmlInclude..?

I want to create a structure like: <root> <items> <myns:a s="a"/> <b s="a"/> </items> </root> Where the items in root are descendant from a common base class. I just cannot get it working. The following snippet creates <root> <items> <Base xsi:type="A" s="a"/> <Base xsi:type="B" s="a"/> </items> </root> [Serializable] [X...

Dump SQL Server to XML?

In mysql, you can use mysqldump --xml to dump to XML. How do you dump a SQL Server database? Preferably to XML. ...

C# / NET CF 2.0 DataSet serialization problem

Hi, I'm creating a XML DataSet from my destktop application: <?xml version = "1.0" encoding="Windows-1252" standalone="yes"?> <MyDataSet> <xsd:schema id="MyDataSet" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:element name="MyDataSet" msdata:IsDataSet="true"> <xsd:com...

XmlSerialization throwing error when deserializing?

I am trying to serialize an object into the database using xml serialization, however when deserializing it I am getting an error. The error is There is an error in XML document (2, 2) with an inner exception of "<MyCustomClass xmlns=''> was not expected." The code I am using to serialize is: public static string SerializeToXml<T>(T ...

XSD Generation of a runtime object

I am trying to generate a C# class based on an .xsd schema. This schema has several imports which I included on the command line in my batch file. It also has includes that should be resolved by using the schemaLocation to find the file on the disk. I am getting errors for several types that are supposedly not declared. These definit...

IXmlSerializable dictionary in C# without 'Key'/'Value' nodes

I'm trying to serialize a dictionary in C#. All the examples I've been able to find create XML like the following: <Dictionary> <ArrayOfEntries> <Entry> <Key>myFirstKey</Key> <Value>myFirstValue</Value> </Entry> <Entry> <Key>mySecondKey</Key> <Value>mySecondVal...

Xml Serialization / Deserialization Problem

After writing and reading an xml string to and from a stream, it ceases to be deserializable. The new string is clipped. string XmlContent = getContentFromMyDataBase(); XmlSerializer xs = new XmlSerializer(typeof(MyObj)); MemoryStream ms = new MemoryStream(); StreamWriter sw = new StreamWriter(ms); char[] ca = XmlContent.ToCharArray(); ...

Custom Config file with subelements instead of attributes

I am working on making a custom section of my app.config and web.config to read a configuration in. I'm following the code at http://consultingblogs.emc.com/pauloreichert/archive/2005/05/31/1514.aspx for my sample. The problem is, my config file generates as follows: <configSections> <section name="BizDays" type="Holidays.BizDaysS...

Force XmlSerializer to serialize DateTime as 'YYYY-MM-DD hh:mm:ss'

I have a XSD schema for some RESTful service. When used in conjunction with xsd.exe tool to generate C# code, XSD's xs:date generates the following code: [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType="date")] public System.DateTime time { get { return this.timeField;...

How do you avoid creating multiple instances of an object with XML Deserialization?

I've got a class that when serialized to XML looks like this (generalized for simplicity): <root> <resources> <resource name="foo" anotherattribute="value">data</resource> <resource name="bar" anotherattribute="value">more data</resource> </resource> <myobject name="objName"> <resource name="foo" /> </myobject> </roo...

SDO XML DAS Avilibility in Shared PHP Hosting

What % of Shared Hosting Package Provide SDO XML DAS Extension installed. or has the capability to install it for the User. i.e. If my Application makes use of SDO XML DAS would I be able to work with it on any Shared Hoisted Server ? ...

C#, problem mixing Xml Serialization with Nhibernate

I am working on a program that uses Nhibernate to persist objects, and Xml Serialization to import and export data. I can't use the same properties for collections as, for example, Nhibernate needs them to be Ilists, because it has it's own implementation of that interface, and I can't Serialize interfaces. But as I need both properties ...

F# - Recursive Read XML Data

Deat alls, I try to work this few rows of code, but I really do not know why the 'myTreeNodes' List of TreeNodes reset during the call of the 'extractData' routine. It seem that I have respected all the necessary constraints and good practice, but something ... I have missed! Many thanks in advance for any of your suggestion ANN Cod...