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

How do I serialize an object to xml but not have it be the root element of the xml document

I have the following object: public class MyClass { public int Id { get; set;} public string Name { get; set; } } I'm wanting to serialize this to the following xml string: 1 My…
mezoid
  • 28,090
  • 37
  • 107
  • 148
2
votes
1 answer

Xml Serializing ICollection

We're working on a project with a modestly-complex model, the core class of which has a number of properties that are lists of other associated classes. We're using EF 6 (code first) on the back end, and, following guidance on how to construct…
J.D. Ray
  • 697
  • 1
  • 8
  • 22
2
votes
0 answers

XML Serialization does not require Serializable keyword for objects

Car car1 = new Car(); car1.CarMake = "Ford"; car1.CarModel = "Mustang GT"; //1. Serialization to a file Stream stream = File.Open("CarInformation.txt", FileMode.OpenOrCreate); BinaryFormatter bform = new BinaryFormatter(); bform.Serialize(stream,…
Afz
  • 77
  • 2
  • 16
2
votes
2 answers

XML serialization and MS/Mono portability

I'm trying to have classes serialized using MS runtime and Mono runtime. While using MS runtime everything goes fine, but using Mono I give me some exception and program startup. The following exception are thrown: There was an error reflecting a…
Luca
  • 11,646
  • 11
  • 70
  • 125
2
votes
2 answers

Flag certain properties as CDATA elements for serialization

When serializing/de-serializing certain classes I've come across the need to flag or mark certain properties as CDATA elements (due to their content). I am currently handling this like so: _ Public Property…
Sean Gough
  • 1,721
  • 3
  • 26
  • 47
2
votes
1 answer

XML Serializing Element with prefix

blgrnboy
  • 4,877
  • 10
  • 43
  • 94
2
votes
2 answers

XMLSerializer serializes correctly, but throws TargetInvocationException when deserialzing

I'm making an inventory system for a Unity game. It serializes and saves the inventory to an xml file as expected; However, when I deserialize, the items are set to null and a TargetInvocationException is thrown; and ultimately a…
2
votes
3 answers

MSMQ first Message.Body in queue is OK, all following Message.Body in queue are empty

I send a handful of identical (except for Id#, obviously) messages to an MSMQ queue on my local machine. The body of the messages is a serialized XElement object. When I try to process the first message in the queue, I am able to successfully…
Andrew A
  • 63
  • 2
  • 9
2
votes
1 answer

.NET XML Serializer with Japanese chars in username

We are having a problem whenever our application makes use of the XML Serializer, when we are logged in as a user who has a username containing Japanese characters. We have prepared a sample application that tests the serializer on its own: …
Duncan
  • 10,218
  • 14
  • 64
  • 96
2
votes
1 answer

c# XML serialization assigning value to element

Im trying to get my XML to look like it does below filepath filepath What i have currently is public class…
Sean Wagner
  • 121
  • 1
  • 2
  • 9
2
votes
1 answer

JAXB - Make nested child element from Java object filed

I am trying to generate an XML file from Java object via JAXB. I have the following Java class: @XmlRootElement public class StudentsInfo { String university; String faculty; long facultyNumber; int degree; String specialty; …
Delumees
  • 35
  • 1
  • 5
2
votes
1 answer

XML object binding of types derived by restriction

I am trying to take a XML Schema and convert the relationships to C# classes. The situation I am running into is as follows: I have a complex type in the schema which has 4 elements all of a certain type:
Jason Roell
  • 6,679
  • 4
  • 21
  • 28
2
votes
1 answer

JAXB enum field not being serialized

I have the following class: package dictionary; import java.io.Serializable; import java.util.Objects; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlTransient; public…
José D.
  • 4,175
  • 7
  • 28
  • 47
2
votes
0 answers

Any way to avoid the mess of C# xml serialization?

I am trying really hard to keep my base classes "clean" while using XML serialization and was wondering if there is any other option. Let me explain first what the situation is. I have base classes that look like that: public class Project { …
Dimitris
  • 2,030
  • 3
  • 27
  • 45
2
votes
1 answer

Deserialize XML file in C#

IDE: Microsoft Visual Studio 2010 Language : C#, XML I am trying to deserialize XML file to object, but it throws me the error in XML document (5,4).Any suggestions ? Here is the code I have tried ... public void ReadXMLtblFieldingDetails(string…
Harsh Kumar Singhi
  • 201
  • 1
  • 3
  • 10
1 2 3
99
100