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

Map serialization in JAX-B producing unwanted XML namespaces and prefixes

Problem: I'm trying to do a simple serialization of a HashMap with JAX-B in a JAX-RS application and running into extra output that I'd like to avoid. The default serialization of the HashMap includes XML namespaces and prefixes that are useless…
A. R. Younce
  • 1,913
  • 17
  • 22
2
votes
1 answer

How can I control the element names of serialized subclasses?

Let's say I have the following class structure (simplified from my real-world problem): Public Class PC_People_Container Private _people_list As New List(Of PL_Person) Public Sub New() End Sub Public Sub Add(ByVal item As…
tmountjr
  • 1,423
  • 2
  • 22
  • 38
2
votes
3 answers

Control XML element name dynamically during serialization

here's my problem to be solved: I've a plugin-structure for multimedia shows that allows to implement media types in external assemblies by subclassing from a base class in my framework. A show holds a list of media types. Shows are loaded and saved…
Felix
  • 101
  • 1
  • 2
  • 6
2
votes
2 answers

XmlSerialization, Serialize only one Property of a Child Element

With a model such as .. class Base { public Child Child { get; set; } } class Child { public int Id { get; set; } // other properties } I want to do Xml Serialization, but for the Child object on Base, I only want to serialize the Id…
Ciel
  • 17,312
  • 21
  • 104
  • 199
2
votes
0 answers

How can I skip objects in XML Deserialization that throw errors?

I am using XML Deserialization for very large XML documents (sometimes over 200MB). The most documents are going very well, but sometimes the Deserialize function throws errors. For example: When an integer is a string, you get the "Wrong format…
Tomprg
  • 21
  • 2
2
votes
0 answers

Jackson XmlMapper how to serialize a list with dynamic tag name

So I'm trying to serialize a java object with a list to an xml file but the problem with the format that I'm trying to do is it requires the list to have dynamic element names. I'm trying to do something like this,
kr20
  • 21
  • 1
2
votes
1 answer

.Net XmlSerializer Output Data Type

I have a method which takes an object and turns it into a string of XML. This works great but I want the output XML to include the data type of object properties (string, int, double, etc). I've searched high and low but I can't seem to find a…
Daniel Knoodle
  • 384
  • 1
  • 4
2
votes
1 answer

Deserializing xml string to an object and I get empty list of missing list element. Why does it not return null?

public class Warning { public Warning() { } public Warning(String name, List conflictList) { Name = name; ConflictList = conflictList; } public string Name { get; set; …
bobbo
  • 845
  • 2
  • 14
  • 24
2
votes
2 answers

XML Recursive Deserialization

I have some XML that I am trying to deserialize. The Kronos_WCF object deserializes fine but the Response objects do not. Is there some recursive deserialization teqnique I am missing? Here is the XML I am trying to deserialize:
Cyberdrew
  • 1,832
  • 1
  • 19
  • 39
2
votes
1 answer

How to combine reading and writing of properties in one procedure or function to simplify XML serialization

I want to write and read some properties of an object to an XML file. Therefore I would like to use a procedure which bundles the writing and reading so that I don't have to repeat the list of XML node paths and names (one for writing and one for…
user3384674
  • 759
  • 8
  • 28
2
votes
2 answers

XML serialization and why am I ending up with an ended element?

What am I doing wrong here? Test XML: White Back Folding Boxboard - GC1
Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
2
votes
1 answer

XmlSerializer: exception inside a property setter is caught in .NET 2.0 but not in 4.0

I can't find an answer to this. Hope anyone can help. I have a property setter that throws an exception if the value doesn't meet certain conditions. The class where the property lives is serialized/deserialized. When deserializing the class in .NET…
Sam
  • 21
  • 2
2
votes
2 answers

Serialize classes to 'almost' xml strings in c#

Can/should XmlSerialiser be used to de/serialize the following, 3rd party defined, message protocol that is 'similiar' to xml? The protocol specifies a number of messages, some contain attributes others don't e.g. Protocol A A GetEvent message is…
hanlonj
  • 319
  • 4
  • 16
2
votes
1 answer

XML serialization/deserialization best practice: XmlSerializer or Linq To XML?

Nowadays, what's the best way to serialize/deserialize domain objects into an xml document? XmlSerializer or Linq To XML? What are the pros and cons of each solution?
2
votes
1 answer

xmlserializable dictionary implementation in C# using Space efficient xml

Are there any known dictionary implementations in C# that space efficiently persists itself as XML. It should support generics it may assume that all elements inserted are of the generic type (ie. no subtype is inserted) - Hence the type…
Carlo V. Dango
  • 13,322
  • 16
  • 71
  • 114