Questions tagged [xml-serialization]

This tag refers to serialization technologies which use XML as a data format.

This tag refers to serialization technologies which use XML as a data format. In the context of .NET, it refers to the XmlSerializer class, less so to the DataContractSerializer class, still less to the SoapFormatter class.

4687 questions
2
votes
1 answer

Language identification for xml tags while using built-in xml serialization mechanisms

Suppose, I have a simple type: public class Report { public Report() { BirthDate = new Element(); BirthPlace = new Element(); } public Element BirthDate { get; set; } public Element BirthPlace { get; set;…
jwaliszko
  • 16,942
  • 22
  • 92
  • 158
2
votes
5 answers

how to write xml to a stream a network of beans in a memory efficient way

Editing to specify more clearly the scenario. I have to write a xml file, the info comes from several beans (not even whole bean, jsut subset of some of them), some of the beans contain lists etc. So I cannot just give xstream one root bean and let…
Persimmonium
  • 15,593
  • 11
  • 47
  • 78
2
votes
1 answer

Unable to deserialize list in a XML Response using ReadAsAsync

[Update: This question is different from the suggested duplicate because this one is about deserialization of XML and the explanation of the problem and solution on this one is clearer as I've included the full source code.] I'm trying to read and…
Ash K
  • 1,802
  • 17
  • 44
2
votes
2 answers

C# System.Xml.Serialization - use only and never

I have a strange problem with my customer - I am reading an XML document (actually an InfoPath document) with XmlSerializer, modifying it, then writing out an XML document using the XmlSerializer, and then add some processing instructions by using…
Petr Osipov
  • 621
  • 6
  • 16
2
votes
1 answer

How do can I get XmlRoot to have a collection of objects?

I'm trying to figure out how to serialize the following class into XML (in a specific way, see below): [XmlRoot("Farm")] public class Farm { [XmlArray] [XmlArrayItem("Person", typeof(Person))] [XmlArrayItem("Dog", typeof(Dog))] …
Jay Sullivan
  • 17,332
  • 11
  • 62
  • 86
2
votes
1 answer

XmlSerializer errors after updating from .NET 3.5 to .NET 4.6

So I recently updated a project from .NET 3.5 to .NET 4.6 and my XML serialization stopped working. I narrowed it down to a single structure that, I agree, looks weird. [XmlElement("price1", typeof(PriceBonusData))] [XmlElement("price2",…
Wojtek Pojda
  • 124
  • 1
  • 11
2
votes
1 answer

How to solve: "You need to add XmlChoiceIdentifierAttribute to the member." when using XmlAttributeOverrides?

I'm trying to use XmlAttributeOverrides to change the way my class is being serialized to XML. I need to exclude some properties and include others in a specific order. I have this code here: // XML Attribute Overrrides public static…
Shiasu-sama
  • 1,179
  • 2
  • 12
  • 39
2
votes
1 answer

XML serialization not getting expected xml file c#

I deserialized a xml file which looks like : BALA_ORLS_G111
AmirDevouche
  • 45
  • 1
  • 6
2
votes
1 answer

Should i use XML Serialization with large file

I have a set of very large XML data with XSD. One xml might be up to 300MB. I need to move data from XML into SQL Server. I found that Microsoft has serialization library to map xml into…
jojo
  • 13,583
  • 35
  • 90
  • 123
2
votes
1 answer

How to only show xml attributes that are not optional? In C#

I want to only show non-optional data from an XML file in C# but I've never used it before and I'm new in the serialization method. I've got an XSD with:
KDP
  • 1,377
  • 3
  • 11
  • 13
2
votes
1 answer

How can I make ShouldSerialize*() apply only to XML and not JSON serialization?

I'm using the ShouldSerialize method to conditionally serialize a field when I use XmlSerializer. But now I need to serialize the same class using JSON, but I would like the ShoulSerialize method to be ignored when using JSON, can I do this in any…
Paulo Balbino
  • 243
  • 1
  • 14
2
votes
4 answers

XmlSerializer can't find EntityObject even though its referenced

I hope that someone can help me with this problem that I've been having with XmlSerializer. I've already looked through this thread: http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/551cee76-fd80-48f8-ac6b-5c22c234fecf/ The error I…
MisterHux
  • 140
  • 12
2
votes
1 answer

condition in linqToXml

XML 1 aaa 2 bbb Code question="aaa"; var doc = XDocument.Load(Server.MapPath(".") +…
ashkufaraz
  • 5,179
  • 6
  • 51
  • 82
2
votes
1 answer

.NET Binary XML

How does .NET's Binary XML work? There's some documentation on it at http://msdn.microsoft.com/en-us/library/cc219210.aspx, but it doesn't say how to make it. There isn't even an example of the output. I'm guessing anything related to binary xml…
grant
  • 735
  • 8
  • 17
2
votes
2 answers

Xml Serialization of a Collection with Properties

I have this simple class: public class MappingCollection : List { private int _declaredTotal = -1; public int DeclaredTotal { get { return _declaredTotal; } set { _declaredTotal = value; } } } And I'm using it inside another class,…
Matteo Mosca
  • 7,380
  • 4
  • 44
  • 80