Eddy
Eddy

Reputation: 1453

Simple XML Framework and Android - strange class attribute

I am trying to use the Simple XML library with Android and getting some errors with it (http://pastebin.com/7Nrk1esD), where the main error is this:

"org.eclipse.persistence.indirection.IndirectList in loader dalvik.system.PathClassLoader..."

The Model which has to be deserialized is also used by a rest-server to produce the necessary XML, there are also some JPA-annotations like the following:

@OneToMany
@ElementList(required = false)
private List<Substance> substances = new ArrayList<>();

this line produces the following xml output:

<substances class="org.eclipse.persistence.indirection.IndirectList">
...
</substances>

Here I see now where the error is coming from - Android is not aware of org.eclipse.persistence! But my question is now: Why is the line class="...IndirectList" produced and how can I change that to avoid the errors in the Android application?

PS: I am using simple 2.6.2

thanks in advance!

Upvotes: 0

Views: 817

Answers (2)

ng.
ng.

Reputation: 7189

Try this

@OneToMany
@Path("substances")
@ElementList(required = false, inline=false)
private List<Substance> substances = new ArrayList<>();

This should work.

Upvotes: 0

Eddy
Eddy

Reputation: 1453

Found the Answer here:

Strategy strategy = new TreeStrategy("clazz", "len");
Serializer serializer = new Persister(strategy);

But I use this snippet only in the Android-client to deserialize and NOT to serialize the model in the server.

Upvotes: 1

Related Questions