Questions tagged [ixmlserializable]

Provides custom formatting for XML serialization and deserialization.

IXmlSerializable Interface on MSDN

115 questions
0
votes
2 answers

IList and custom XML Serialization of nested objects

I am trying to serialize IList. So I am using IXmlSerializable for this. The classes are as follows class SerializeTarget : IXmlSerializable { public IList Targets { get; set; } public string Name; #region IXmlSerializable…
Ram
  • 11,404
  • 15
  • 62
  • 93
0
votes
0 answers

Changing a struct to a class in a third party library that implements IXmlSerializable, IFormattable, and IEquatable

I need to do quite a bit 2D geometry work and have found a library that is absolutely perfect for my needs. The specific library is MathNet.Spatial which along with offering the exact functionality that I need, it integrates perfectly with the…
0
votes
1 answer

c# Write/Read complex IXmlSerializable class with XmlSerializer fields

I have a class which I would like to serialize. However, this class implements IEnumerator, so I have to make it IXmlSerializable. My class looks like this: public class Pipeline : IEnumerator, IEnumerable, IXmlSerializable { public…
0
votes
1 answer

IXmlSerializable renaming ElementName

i seen exemple for renaming my Element name since i have lot interface in XMLWrite but how i can deserialize the right type in XMLRead()? public void WriteXml(XmlWriter writer) { XmlRootAttribute x = new XmlRootAttribute(); …
Zwan
  • 632
  • 2
  • 6
  • 23
0
votes
0 answers

How do I make `XmlSerializer` to ignore `IXmlSerializer` implementation?

Based on a certain flag, I need to switch between the default XmlSerialization deserializer and IXmlSerialization interface implementation. How can I do that? E.g. public class SomeClass: IXmlSerializer { //Other primitive and complex…
ANewGuyInTown
  • 5,957
  • 5
  • 33
  • 45
0
votes
1 answer

Encrypted XML file when using IXmlSerializable (c#)

How can I write a XML-File to which I serialize using IXmlSerializable in an encrypted way? I (de-)serialize my data (a structure of nodes containig nodes, just like filesystemfolders) into a xml-File: public class DataNodeCollection :…
suriel
  • 191
  • 1
  • 10
0
votes
1 answer
0
votes
1 answer

Specifying inheritance in WCF XmlSchema

I'm faced with a situation where I have to implement IXmlSerializable on a datatype, which I'll send through WCF service. But when I try to mark the base class in the xsd, the service reference can no longer be refreshed, and the type I'm writing…
TDaver
  • 7,164
  • 5
  • 47
  • 94
0
votes
1 answer

Object resulting from xml deserialization only has 1 element, despite xml having multiple elements

I'm trying to test the serialization for webrequests. I'm doing a unit test where I: - create a mock response from the server - deserialize that response - Compare initial object with deserialized one The issue is one of my arrays in only partially…
0
votes
1 answer

Dynamic XmlSerializer that identifies the object type from the xml-serialization?

Is there any way to create an XmlSerializer that stores along with the serialized data the data type, then when deserializing, it automatically identifies the type of the serialized object and creates an object of that type (returned as object). Any…
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
0
votes
0 answers

How to do xml serilization for derived entity

public abstract class Base { //abstract methods } public class Derived1 : Base { //method implementations } public class Derived2 : Derived1 { //method implementations } I am doing serilization with "Derived2" var serializer =…
user3711357
  • 1,425
  • 7
  • 32
  • 54
0
votes
1 answer

Conditional usage of IXmlSerializable interface methods

I need a way to customize C# XML (de)serialization mechanism in this way: [Serializable] public class MyElement : IXmlSerializable { [XmlAttribute] public string PropertyX { get; set; } [XmlElement] public MySubElement SubElement {…
Filip
  • 3,257
  • 2
  • 22
  • 38
0
votes
1 answer

Can't save XDocument into Application Settings class

I'm trying to use IXmlSerializable ReadXml and WriteXml methods with an XDocument object ( using the Foo.WriteTo( ... ) and XDocument.Load( ... ) methods. I want to store the class which implements the IXmlSerializable interface into a variable…
Will
  • 3,413
  • 7
  • 50
  • 107
0
votes
2 answers

how to serialize List of CustomClass with object attribute

I want to serialize CMainClass: [XmlType("Param")] public class CParam { [XmlElement] public string Name; [XmlElement] public object Value; public CParam() { } public CParam(string name, object value) { Name =…
Pavel
  • 11
  • 3
0
votes
1 answer

XmlSerializer throws System.InvalidOperationException

So basically I have 2 classes: public class Configuration { public Configuration() { Sections = new List
(); } public List
Sections { get; private set; } } public class Section : IXmlSerializable { …
Kovpaev Alexey
  • 1,725
  • 6
  • 19
  • 38