Provides custom formatting for XML serialization and deserialization.
Questions tagged [ixmlserializable]
115 questions
2
votes
1 answer
How can I control the root element namespace and name when serializing an IXmlSerializable object with the data contract serializer?
I have a type that implements IXmlSerializable which I am serializing with DataContractSerializer. How can I control the root element namespace and name when serializing it as the root element of an XML document?
Say I have the following type: …

dbc
- 104,963
- 20
- 228
- 340
2
votes
1 answer
Custom serialization of a dictionary fails when xml has indentation/line break
In order to have a cleaner XML of a Dictionary serialization, I wrote a custom class, that implements IXmlSerializable.
My custom class is defined like this:
public class MyCollection : System.Collections.Generic.Dictionary,…

Steve B
- 36,818
- 21
- 101
- 174
2
votes
1 answer
IXmlSerializable list item
For fun, I'm trying to develop a simple RPG. I would like my game to use XML files in order to make the game easily customizable by players.
I got a race class and a raceManager class with a static list of all races.
I started by using XmlAttributs…

Vanbrabant Thomas
- 41
- 5
2
votes
1 answer
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:
myFirstKey
myFirstValue
…

Sarah Vessels
- 30,930
- 33
- 155
- 222
2
votes
0 answers
Annotate IXmlSerializable
I've created a type, which implements IXmlSerializable and uses XmlSchemaProviderAttribute to define its schema, for use in a WCF service. All according "best practice"/MSDN as far as I know.
Long story short, I must use IXmlSerializable for various…

user2308941
- 51
- 1
2
votes
1 answer
Is there a way to make a serialized member to serialize as an attribute?
Is there a way to make a serialized member to serialize as an attribute:
Public Class Person
Public Property Name As String
End Class
I want than when this class is xml-serialized, it should produce:

Shimmy Weitzhandler
- 101,809
- 122
- 424
- 632
2
votes
2 answers
How to save a datatable if it contains an object that refuses to serialize?
I'm storing GData "Event" objects from the Google API in a datable (Ok, I had to cast them as an object or they wouldn't go in), and I can access all the properties of the events perfectly, and use them to update Google, but I cannot serialize the…

jazzwhistle
- 337
- 2
- 12
2
votes
0 answers
How to implement IXmlSerializable correctly for a ICollection where T is an abstract class?
I'm trying to implement IXmlSerializable interface in a Collection of T where T is an abstract class.
My scenario is this:
I've got a abstract class BaseClass which implements IXmlSerializable
Two derived clases (Deriv01, Deriv02) which inherits…

manoloarbulu
- 21
- 3
2
votes
3 answers
Custom Serialization using XmlSerializer
I have a class that I need to do some custom XML output from, thus I implement the IXmlSerializable interface. However, some of the fields I want to output with the default serialization except I want to change the xml tag names. When I call…

KrisTrip
- 4,943
- 12
- 55
- 74
2
votes
0 answers
C# serialization of derived classes using IXmlSerializable
I'll try to make my problem as simple, as possible. Below are 2 sample programs to demonstrate it. U can just copy&paste it into Visual Studio, if U need to analyze it.
Feel free to comment and correct my English. Hope you can understand me.
My…

Jakub Szułakiewicz
- 821
- 5
- 22
2
votes
2 answers
correct serialize but incorrect Deserialize
consider following codes and classes:
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Serialization;
namespace ConsoleApplication1
{
public class Element1
{
[XmlAttribute]
public int…

Rzassar
- 2,117
- 1
- 33
- 55
2
votes
2 answers
IXmlSerializable and XmlSerializer together issue
I have around 50 classes in polymorphic, inheritance relation. I used XmlSerializer to serialize them. Now for few classes I want to implement IXmlSerializable. So I started for one of class.This class not base class but derived directly from base…

user1451825
- 21
- 2
1
vote
3 answers
XML Serialization, in this case, IXmlSerializable or Attributes
I've done some XML serialization before but i used Attributes, I'm not sure this is doable for my next assignment, here's a brief list of XML manip requirementes.
General Purpose XMl manipulation, tied to a treeview, no schema.
Load/Save…

Firoso
- 6,647
- 10
- 45
- 91
1
vote
0 answers
Getting Property's Custom Attributes during Serialization
I have a custom Dictionary that implements IXmlSerializable and i'm trying to create a custom attribute that can be applied to properties like XmlElementAttribute can :
Property Cake As Bread
A new XmlDictionaryAttribute, like…

VampireMonkey
- 177
- 2
- 11
1
vote
2 answers
IXmlSerializable. XmlWriter. How to change root element?
I need to serialize my Invoice model to Xml in 2 different ways.
First serialization should have "FirsName" as root element.
Second "SecondName".
There is different ways to implement, but i don't know how to implement them.
Either to avoid root…

Andrew
- 591
- 2
- 12
- 33