Questions tagged [unmarshalling]

Unmarshalling is the process of transforming the storage or transmission representation of an object back into its original memory representation. It is the inverse of marshalling.

Unmarshalling is the process of transforming the storage or transmission representation of an object back into its original memory representation. It is the inverse of marshalling.

Unmarshalling is the same as Deserialization that is known in .NET and Java.

1717 questions
66
votes
4 answers

javax.xml.bind.UnmarshalException: unexpected element. Expected elements are (none)

I am getting this error, while unmarshalling a string. I have created Java files using JAXB. JAXBContext jaxbContext = JAXBContext.newInstance(DocumentType.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); // Input string posted…
user3102817
  • 683
  • 1
  • 5
  • 5
64
votes
3 answers

JAXB: How to marshal objects in lists?

Perhaps a stupid question: I have a List of type which I want to marshal into a XML file. This is my class Database containing an ArrayList... @XmlRootElement public class Database { List records = new ArrayList(); public…
rmv
  • 3,105
  • 4
  • 22
  • 28
62
votes
8 answers

Android E/Parcel﹕ Class not found when unmarshalling (only on Samsung Tab3)

I've been unable to resolve why this error occurs, and only on a Samsung Tab3 device, running 4.4.2? It happens when my MainActivity starts another Activity, and passes a Parcelable class in the intent like so: private void…
52
votes
4 answers

"BadParcelableException: ClassNotFoundException when unmarshalling " while using Parcel.read method that has a ClassLoader as argument

Given a custom class org.example.app.MyClass implements Parcelable, I want to write a List to a Parcel. I did the marshalling with List myclassList = ... parcel.writeList(myclassList); whenever I try to unmarshall the class…
Flow
  • 22,048
  • 13
  • 91
  • 147
44
votes
3 answers

Cannot unmarshal string into Go value of type int64

I have struct type tySurvey struct { Id int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` } I do json.Marshal write JSON bytes in HTML page. jQuery modifies name field in object and encodes object…
Max
  • 5,896
  • 5
  • 39
  • 82
44
votes
2 answers

How to marshall and unmarshall a Parcelable to a byte array with help of Parcel?

I want to marshall and unmarshall a Class that implements Parcelable to/from a byte array. I am well aware of the fact that the Parcelable representation is not stable and therefore not meant for long term storage of instances. But I have a use case…
Flow
  • 22,048
  • 13
  • 91
  • 147
38
votes
11 answers

How to fix Unmarshalling unknown type code XXX at offset YYY in Android?

I'm having app crash on resume because of Unmarshalling exception. I've checked all the Serializables have constructor with no parameters and even checked all the serializables using ObjectStream (save to file and load from file). How can i…
4ntoine
  • 17,607
  • 16
  • 70
  • 175
30
votes
4 answers

JAXB - Ignore element

Is there any way to just ignore an element from Jaxb parsing? I have a large XML file, and if I could ignore one of the large, complex elements, then it would probably parse a lot quicker. It would be even better if it could not even validate the…
questioner
  • 735
  • 4
  • 8
  • 15
30
votes
5 answers

Is there a package to marshal in and out of x-www-form-urlencoding in golang

I would like to marshal in and out of x-www-form-urlencoding similar to how you can do it with json or xml. Is there an existing package to do this, or are there any documents on how to implement one myself if none exist?
placeybordeaux
  • 1,928
  • 1
  • 16
  • 35
30
votes
5 answers

when does JAXB unmarshaller.unmarshal returns a JAXBElement or a MySchemaObject?

I have two codes, in two different java projects, doing almost the same thing, (unmarshalling the input of a webservice according to an xsd-file). But in one case I should write this: (Input is a placeholder name) ( element is OMElement input…
Stephane Rolland
  • 34,892
  • 31
  • 111
  • 159
24
votes
3 answers

ClassNotFoundException when unmarshalling and really don't know why

FIXED: ANSWER AT BOTTOM I am writing an android app for a project and im trying to use parcelable objects. I have 2 parcalable classes. The first is a normal class with only 2 arguments. The second one is a class with additional attributes and a…
Christian Risch
  • 261
  • 1
  • 2
  • 6
23
votes
3 answers

How can I have JAXB call a method after it has completed unmarshalling an XML file into an object?

I am using JAXB to unmarshall an XML file into a Java object -- standard stuff. Once JAXB has completed this, I'd like a method to be called on the newly created object. Is there a mechanism to do this? I'd prefer the object, not an external…
Elliot
  • 1,256
  • 2
  • 12
  • 22
23
votes
2 answers

What's the difference between JAXB annotations put on getter versus setters versus members?

Title says it all. I would like to know what is the principial difference between putting JAXB annotation (like @XmlElement) on field / getter / setter. It seems to me that (in simple cases) it does not matter. E.g. lets take this class A { …
stewenson
  • 1,162
  • 1
  • 13
  • 30
23
votes
4 answers

json.Unmarshal nested object into string or []byte

I'm trying to Unmarshal some json so that a nested object does not get parsed but just treated as a string or []byte. So I want to get the following: { "id" : 15, "foo" : { "foo": 123, "bar": "baz" } } Unmarshaled into: type Bar struct { …
Ilia Choly
  • 16,442
  • 12
  • 75
  • 145
22
votes
2 answers

How to unmarshal JSON into durations?

What is the idiomatic way to unmarshal into time.Duration in Go? How can I make use of time.ParseDuration?
user6216224
1
2 3
99 100