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
2 answers

Generate two different xml serializations for a .net class

I have a set of .net classes that I currently serialize and use with a bunch of other code, so the format of that xml is relatively fixed (format #1). I need to generate xml in another format (format #2) that's a pretty similar structure but not…
Rory
  • 40,559
  • 52
  • 175
  • 261
2
votes
1 answer

C# XML Serialization in UWP

I am trying serialize more than one list to a unique xml file. My project is a UWP, currrently it seems serialize my 3 list but the file is showed empty. Previously a user help me with part of the code. How I could correctly serialize it. To…
user6366050
2
votes
2 answers

VB.Net Serialize anonymous type to xml

In MVC I can do something like the following to serialise an object with an anonymous type to JSON... Public Function GetStateList() As JsonResult Dim MyObject = New With {.Id = 1, .Property = "SomeValue"} Return…
Basic
  • 26,321
  • 24
  • 115
  • 201
2
votes
2 answers

.NET: Posting Xml to a web-server?

What is the proper way to post an XmlDocument to a web-server? Here is the skeleton function: public static void PostXml(XmlDocument doc, String url) { //TODO: write this } Right now i use: //Warning: Do not use this PostXml…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
2
votes
2 answers

Changing inherited class name in XML C#

I am serializing a set of classes that looks like: public class Wrapper { IInterface obj; } public interface IInterface { } [XmlType("ClassA")] public ImplA : IInterface { } Currently the XML generated looks like
codechobo
  • 829
  • 1
  • 7
  • 12
2
votes
2 answers

Serializing data from classes with constructors

I am trying to find the best practices or some accepted design patterns for serializing classes that aren't built for serialization. Below is the method I've currently implemented: For example, consider some simple class where I want a…
jetimmins
  • 21
  • 3
2
votes
2 answers

LINQ to XML - how do I obtain index

I have an array of Car objects and using the following piece of code I create an XML Document from these objects. I have set up a counter variable i to be able to index the Car elements in the document. Is there a different way of obtaining the…
Peter Perháč
  • 20,434
  • 21
  • 120
  • 152
2
votes
2 answers

Xstream to map "choice" elements of XML

I need to map an XML, constrained by an XSD to Java object using XStream. The XSD has 4 complex type elements, which are "choice" elements, that is either one of those 4 can be present in the XML under a root tag. I have been looking at XStream but…
PaiS
  • 1,282
  • 5
  • 16
  • 23
2
votes
2 answers

Customizing XStream output

I have a class that resembles something like this: class foo { List bar; ... } I add four Strings to the list bar: bar.add("1"); bar.add("2"); bar.add("3"); bar.add("4"); Using xstream, I've managed to get output that looks like…
pingping
  • 37
  • 1
  • 4
2
votes
2 answers

Spring MVC: Adding JAXB to the classpath so that it automatically serializes XML

According to Spring MVC documentation, configures support for JSON if Jackson is in the classpath, and support for XML if JAXB is present in the classpath. Simply by adding a Jackson dependency to my pom.xml, I get JSON…
Mr. Springy
  • 21
  • 1
  • 2
2
votes
0 answers

C# .NET Serialization - how to include schema in output

I've produced a class using the XSD.EXE for an XML web service. My question is how do I include the schema? Current XML output:
jon3laze
  • 3,188
  • 6
  • 36
  • 69
2
votes
2 answers

how to serialize a base class variable with a different name in a derived class

Here is a piece of sample code to explain my question: public class TheBaseClass { public list BaseClassList {get; set;} } public class TheDerivedClass : TheBaseClass { //here I want to indicate the XmlSerializer to serialize the…
Umar T.
  • 411
  • 6
  • 11
2
votes
2 answers

C# Xml Serialization nodes

I have these classes public class ProdutosServicos { public List Produto { get; set; } } public class Produto { public string Descricao { get; set; } public CodigoTipo Codigo { get; set; } public string…
Maturano
  • 951
  • 4
  • 15
  • 42
2
votes
5 answers

C# XML Serialization of Attribute

I have some XML which I would like to serialize into a class. some inner data moredate
thenth
  • 481
  • 2
  • 5
  • 8
2
votes
2 answers

Is there size limit for a property to be serialized?

I'm working against an interface that requires an XML document. So far I've been able to serialize most of the objects using XmlSerializer. However, there is one property that is proving problematic. It is supposed to be a collection of objects that…
Devin Goble
  • 2,639
  • 4
  • 30
  • 44