Provides custom formatting for XML serialization and deserialization.
Questions tagged [ixmlserializable]
115 questions
16
votes
1 answer
Custom XmlSerialization for nested / child objects
I have a scenario in which I have a class Resource which has two other classes nested in it; Action and ResourceURL. I need to write custom xmlserializer for Resource and Action but not for ResourceURL. I implemented IXmlSerializable for both.
The…

Sheikh Usman
- 327
- 1
- 5
- 12
12
votes
3 answers
How to add namespace prefix for IXmlSerializable type
I have a following class definition
[XmlRoot(ElementName = "person",Namespace = "MyNamespace")]
public class Person : IXmlSerializable
{
public string FirstName { get; set; }
[XmlNamespaceDeclarations]
public XmlSerializerNamespaces…

Rudolf Dvoracek
- 904
- 2
- 14
- 30
9
votes
2 answers
"ReadElementContentAsBase64 method is not supported on this XmlReader"
using System.IO;
using System.Runtime.Serialization;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
namespace XmlTest
{
class TestClass : IXmlSerializable
{
public XmlSchema GetSchema()
{
…

Stefan Monov
- 11,332
- 10
- 63
- 120
8
votes
2 answers
Getting the calling variable name of a parameter
In relation to the question Get the name of parameters from a calling method and Finding the Variable Name passed to a Function in C# I'm still looking for a way to define theWhatDoesTheAnimalSay_WANTED method: I want to know the name of the…

Soko
- 774
- 1
- 7
- 20
8
votes
2 answers
C# : WCF Service with IXMLSerializable member turns into DataSet
.NET
I have a web service, one of the data members of a message implements IXmlSerializable, when I do "Add Service Reference" that member becomes a DataSet.
I am trying to pass a serialized Expression as a parameter to the web…

THX-1138
- 21,316
- 26
- 96
- 160
7
votes
3 answers
Namespace Prefixes with IXmlSerializable
Bit confused on the proper decorators to use, or whatever design might be necessary. When serializing a class which is implementing IXmlSerializable is there a way to include the namespace and its prefix in the XmlRoot element?
Class definition for…

Nicholi
- 1,083
- 19
- 33
7
votes
2 answers
How to revert back to 'default' XML serialization when implementing IXmlSerializable in a base class?
I'm trying to serialize a class that inherits from a base class that implements IXmlSerializable.
The base class, called PropertyBag is a class that allows dynamic properties (credits to Marc Gravell).
I implemented IXmlSerializable so that the…

Timmel
- 79
- 1
- 6
6
votes
4 answers
Xml Serialization Dynamic Ignore
I am trying to generate an xml document in a specific format. I would like to skip serializing a property depending on a value of the property.
public class Parent
{
public Parent()
{
myChild = new Child();
myChild2 = new…

TrevDev
- 1,106
- 11
- 24
6
votes
1 answer
Using IXmlSerializable interface on complex object graph
If using custom XML Serialization (IXmlSerialiable), on a complex object that contains properties with constituent complex objects which do NOT use custom IXmlSerializable interface, how do you specify, in the IXmlSerializable.ReadXml(XmlReader…

Charles Bretana
- 143,358
- 22
- 150
- 216
5
votes
5 answers
Is it possible to exclude some members of a type from XmlSerializer serialization?
I have some public members I don't want to be serialized, was wondering if there is an attribute for it?

Joan Venge
- 315,713
- 212
- 479
- 689
4
votes
1 answer
What XML serialization method should I use for a public API?
I'm writing a program that builds up a tree structure made up of classes that inherit from an abstract Node class. There are a number of different type of nodes built into my program. However, I also want to allow more advanced users to be able to…

Eric Anastas
- 21,675
- 38
- 142
- 236
4
votes
1 answer
C# XML serialization override Type of IXmlSerializable Class
Initial question
I want to serialize a List changing the XmlType of the IXmlSerializable class dynamically (so I can't use attributes tags to do that)
I' ve tried to use XmlAttributeOverrides to do that with no success so far.
Here…

Thomas WALTER
- 43
- 1
- 5
4
votes
1 answer
Serialization: Change the name of the root node without changing the class name
Goal
Take a class named "Item" and output its serialized XML as:
Problem
The root node is derived off the class name that is implementing IXmlSerializable.
// By the time I get here 'writer'…

Brandon Boone
- 16,281
- 4
- 73
- 100
4
votes
1 answer
Cannot WriteXML for DataTable because Windows Search Returns String Array for Authors Property
The System.Author Windows property is a multiple value string. Windows Search returns this value as an array of strings in a DataColumn. (The column's data-type is string[] or String().) When I call the WriteXML method on the resulting data-table, I…

AMissico
- 21,470
- 7
- 78
- 106
4
votes
2 answers
IXmlSerializable Dictionary problem
I was trying to create a generic Dictionary that implements IXmlSerializable (credit to Charles Feduke).
Here is my trial:
Sub Main()
Dim z As New SerializableDictionary(Of String, String)
z.Add("asdf", "asd")
…

Shimmy Weitzhandler
- 101,809
- 122
- 424
- 632