Questions tagged [xml-deserialization]

XML Deserialization is the process of re-creating an in-memory object from its serialized state which used XML as a data format.

1004 questions
3
votes
1 answer

WebAPI 2.0 Post Not Deserializing List Property

I have reviewed every similar article I can find here and tried anything that looked like it might work with no success (obv since I am now asking the question). I have a webAPI 2.0 controller with a POST action that takes in an object of type…
D J
  • 243
  • 1
  • 2
  • 12
3
votes
7 answers

Get an element from List based on ID

This question is related to this question: Given System.Type T, Deserialize List Given this function to retrieve a list of all elements... public static List GetAllItems() { XmlSerializer deSerializer = new…
3
votes
2 answers

Deserialize xml to Generic type

I need class which takes two parameter 1- Type ==> class name 2- xml string ==> xml document in string format. now following class convert xml to object which is all working fine but I need final version as generic type Converter class public…
K.Z
  • 5,201
  • 25
  • 104
  • 240
3
votes
0 answers

Web API Serialize/Deserialize Derived types

I have a Web API that returns a list of objects, when the client passes Accept application/json I want my globally registered json formatter to include TypeNameHandling for the derived types during serialization. However this doesn't work and I…
3
votes
1 answer

deserialization of complex object c#

I'm trying to deserialize an object in xml which is deeply nested. Here's the xml code: ... text ...
Armin Lizde
  • 41
  • 1
  • 3
3
votes
2 answers

Trying to deserialize xml array into C# classes with subclasses

I've got a simple example that I've boiled down from my real code. The problem is that I can create a C# class below as long as I'm able to explicitly assign the type in the class hierarchy. But, my array of Panels doesn't create a subclassed…
wandercoder
  • 392
  • 2
  • 16
3
votes
4 answers

c# Deserialize with IXmlSerializable

I have xml like this: 2 6,501698000000 8,414278000000 9,292674000000 8,551982000000
3
votes
2 answers

Error with XML deserialization an IEnumerable class

I'm trying to serial and deresial HistoryRoot class to this XML format:
NoName
  • 7,940
  • 13
  • 56
  • 108
3
votes
1 answer

Restsharp xml Deserialization to list without changing the name of model

I have xml that is not very well formed, but need to map to a List with RestSharp. I do not have control of the service/ xml output. Thus far, I was able to get around issues with the properties themselves using the DeserializeAs(Name="name")]…
Dan
  • 91
  • 5
3
votes
2 answers

Question about XML deserialization in .net

I'm trying to deserialize an XML that comes from a web service but I do not know how to tell the serializer how to handlke this piece of…
ryudice
  • 36,476
  • 32
  • 115
  • 163
3
votes
1 answer

How to debug XML deserialization?

I was wondering if you had any tips on how I can debug the below XML deserialization? I cannot get it to work. The deserializer basically creates the summon and slash instances, but all their properties are empty. The relevant classes to are shown…
Anders
  • 580
  • 8
  • 17
3
votes
0 answers

Download XML and parse it with ReadAsAsync

I'm trying to download XML document and parse it with the following piece of code: using (var client = new HttpClient()) { client.BaseAddress = new Uri(@"https://domain.com/"); client.DefaultRequestHeaders.Accept.Add( new…
3
votes
1 answer

How to deserialize a tag nested within a text section of another tag?

How to represent the structure of the following XML for its further deserialization into classes? Text in HeadElement start Text in SubElement Continue text …
Kseniya Tsk
  • 115
  • 1
  • 1
  • 6
3
votes
1 answer

XML deserialization problem (attribute with a namespace)

I'm trying to deserialize the following XML node (RDF actually) into a class.
Johnny
  • 7,073
  • 9
  • 46
  • 72
3
votes
2 answers

Deserialize a portion of xml into classes

So if I have 3 different files that contain extremely long and complex xml (which i've abbreviated here) but just the root element name is different (not really random but I'd rather not duplicate classes for the same xml): File 1
Erik Philips
  • 53,428
  • 11
  • 128
  • 150