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

XML Serialization - handling special cases

I need to XML serialize some classes, which in some cases do not adhere to the rules and guidelines, that is needed in order to make built-in serialization work. This includes properties that are interface types and properties without setters. I…
driis
  • 161,458
  • 45
  • 265
  • 341
2
votes
1 answer

Logging xml data in an xml log file

I am needing to log some xml data (which is currently a JDOM Document), and I am trying to output it to a standard Java log. However, this will only produce logs with the < and > ends of the tags re-encoded as <? ?> etc. Although this can…
Alistair Collins
  • 2,200
  • 5
  • 25
  • 44
2
votes
1 answer

Xml Deserializer to deserialize any data type

Because I haven't found a better way to handle my configuration, I have been using XmlSerializer to serialize a Dictionary (explain that later) containing all the things I want saved. Now that I have gotten more crafty, I have started to build more…
David Stocking
  • 1,200
  • 15
  • 26
2
votes
2 answers

Defining XmlRoot and typeof it with a variable?

[XmlRoot("ConfigurationRoot")] public class XmlDBConfiguration { [XmlArray("Customers")] [XmlArrayItem("Customer", typeof(Customer))] public ArrayList _customers; private Dictionary _customerDictionary;} Is it…
Kubi
  • 2,139
  • 6
  • 35
  • 62
2
votes
1 answer

XML namespace for attributes

Question: I have an xml element + attributes, which all need to be in a namespace. I set the element + all attributes into the namespace oai, and I get: but the XML i need to generate should look like this: …
Stefan Steiger
  • 78,642
  • 66
  • 377
  • 442
2
votes
0 answers

Creating a unity3d plugin for reading/writing save games on Windows store/phone

I'm trying to create the plugin described in the title. But I cant seem to get it to work with unity. Following the instructions I created the real plugin and placed it in the WSA folder in the Plugins folder. Then I created a fake plugin for the…
Uri Popov
  • 2,127
  • 2
  • 25
  • 43
2
votes
1 answer

Error Deserializing xml file with XmlSerializer

I'm trying to deserialize an xml with XmlSerializer and I get InvalidOperationException: was not expected. Here's the xml file:
Mihai Stan
  • 143
  • 1
  • 13
2
votes
1 answer

XmlInclude to (De)Serialize Inherited Types in Separate Assemblies

I have this scenario: namespace MyApp.Animals { public class Dog : MyApp.Categories.Canine ... So I'm trying to serialize/ deserialize the dog class. Unfortunately I can't use the [XmlInclude] attribute, because by adding it to the parent…
Jeeby
  • 1,464
  • 1
  • 25
  • 30
2
votes
3 answers

.Net Xml Deserialization - Support Multiple Namespaces

I need to support XML deserialization of two very similar, yet different xml files. File 1:
MattH
  • 1,975
  • 6
  • 24
  • 31
2
votes
2 answers

IDeserializationCallback in XMLSrializer

Is there a way to utilize the IDeserializationCallback interface with the standard xmlSerializer? It does not appear to be supported in this context. IDeserializationCallback works fine when used with the binary formatters. Basicaly i want to do…
Waheed
  • 10,086
  • 20
  • 53
  • 66
2
votes
2 answers

deserialize `Dictionary>>` from custom XML using XElement

I have a Dictionary>> email in which i want to write to XML (Serialize) and also load from XML to Dictionary. I got the write to XML as such: public void WritetoXML(string path) { var xElem = new XElement( …
lynx
  • 45
  • 1
  • 7
2
votes
2 answers

Deserialize XMLto array of objects, or singular object

I'm trying to write a generic method that can be used to deserialize xml to an array of objects. Given XML that looks like so: content more…
ChadT
  • 7,598
  • 2
  • 40
  • 57
2
votes
2 answers

rename property in xml schema class when serializing

I have an auto generated c# class file from an xml schema using the xsd generator tool. There is a property in this class that i need to rename from "Balance" to "balance" when the xml file gets created. As this is a generated class i need to update…
AdrianSean
  • 397
  • 1
  • 5
  • 21
2
votes
1 answer

Trimmed down JAXB for just unmarshalling?

I'm building an application where space is at a premium. I'd really like to use JAXB's unmarshalling capabilities, but including the whole library is out of the question. Has anyone pared it down so that only the bits needed for unmarshalling are…
Jeremy Logan
  • 47,151
  • 38
  • 123
  • 143
2
votes
1 answer

how to give array index a named key on runtime

Here i am trying to use XMLSerializer class to convert data from mysql table into an xml file.I want the xml file to be like this For this ,i need to change the numeric indexes into 'book'.Currently i can generate an array of the following form:It…
AL-zami
  • 8,902
  • 15
  • 71
  • 130