XML Deserialization is the process of re-creating an in-memory object from its serialized state which used XML as a data format.
Questions tagged [xml-deserialization]
1004 questions
6
votes
2 answers
Can we configure simple-xml to let it ignore unknown nodes
When using simple-xml, is there a way to let it ignore the nodes it does not recognize?

user496949
- 83,087
- 147
- 309
- 426
6
votes
3 answers
Deserialize XML to object in C# XmlRoot is not working
I am using asp.net (C#) website, I want to Deserialize the XML string using XmlSerializer class.
My Model (.cs file)
[XmlRoot("MedicalClearanceFormRoot")]
public class MedicalClearanceViewModel
{
[XmlAttribute("PassengerName")]
public…

prog1011
- 3,425
- 3
- 30
- 57
6
votes
1 answer
Loading a serialized DataTable in PowerShell - Gives back array of DataRows not a DataTable
I'm trying to save and load a DataTable in PowerShell.
I save it like this:
$dt | Export-CliXml -path "c:\exports\data.xml"
and load it like this:
$dt = Import-CliXml -path "c:\exports\data.xml"
But the type I get back is an array of Rows rather…

Chris
- 183
- 1
- 10
6
votes
2 answers
Xml Deserialization - Merging two elements into a single List object
I have an XML document, and using deserialization, is there a way to combine two elements into one object?
XML example:
3
4
I want to create a list (of type Parameter) that contains both items, 3…

Natalie E
- 75
- 6
6
votes
1 answer
Exclude null properties in JMS Serializer
My consumed XML API has an option to retrieve only parts of the response.
This causes the resulting object to have a lot of NULL properties if this feature is used.
Is there a way to actually skip NULL properties? I tried to implement an exclusion…

David Spiess
- 600
- 1
- 11
- 21
6
votes
5 answers
Instance validation error: * is not a valid value for *
I'm trying to deserialize an XML string, where the value of an element, ain't within the scope of my Enum values.
Public enum MyEnum
{
Unknown,
Car,
Bicycle,
Boat
}
[SerializableAttribute()]
public class MyClass
{
private string…

grmihel
- 784
- 3
- 15
- 40
6
votes
2 answers
Is it safe to use XMLDecoder to read document files?
Serializing Java Beans to XML using XMLEncoder and XMLDecoder seems like a pretty neat approach: many classes from many sources can be serialized reliably, just using their public interface. Using this aproach to serialization is even suggested in…

MvG
- 57,380
- 22
- 148
- 276
6
votes
1 answer
Convert XML with duplicate elements to JSON using jackson
I have some simple data in XML format which I need to convert to JSON and also be able to convert the JSON back into the same XML string. But I'm having problems with doing this using existing jackson (version 2.0.6) libraries.
Here's an example of…

alternative4
- 148
- 1
- 2
- 10
5
votes
2 answers
JAXB and different versions of the class
I wonder if there is any support for different versions of class in JAXB.
My thoughts about it: xml is kind of persistence object of class (serialized value) but class object can be changed due to development (e.g. extending the functionality). Is…

se.solovyev
- 1,901
- 1
- 16
- 20
5
votes
1 answer
How can I cast or deserialize SoapObject to my object?
I have a .Net Webservice that returns a simple serialized object.
I Have the following code to get response from my .Net webservice. How can I deserialize returned XML to my object?
I want to return MyObject instead of SoapPrimitive.
private static…

Bob
- 22,810
- 38
- 143
- 225
5
votes
3 answers
How avoid exception deserializing an invalid enum item?
For simplicity purposes here, I will show my sample code using fruit. In actuality I am doing something more meaningful (we hope). Let say we have an enum:
public enum FruitType
{
Apple,
Orange,
Banana
}
And a…

Elan
- 6,084
- 12
- 64
- 84
5
votes
2 answers
Deserialize element value as string although it contains mixed content
Assuming an XML like this:
content
…
content

JohnDoDo
- 4,720
- 8
- 31
- 47
5
votes
1 answer
XStream - unmarshalling - Type specified in XML not visible
I have some XML files stored by XStream a while ago, and they include references to RandomAccessSubList, a class which is not visible beyond the package level and has no default constructor so XStream throws this…

jimjim
- 420
- 3
- 10
5
votes
1 answer
Can't use XMLGregorianCalendar in Android, even if it is documented?
I really can't understand this one: it looks like Android has the XMLGregorianCalendar class, because it is documented here.
But if you go ahead and try to use it, that's what you get:
10-27 17:21:43.677: E/AndroidRuntime(14850): Caused by:…

frapontillo
- 10,499
- 11
- 43
- 54
5
votes
3 answers