سؤال

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!

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

Try this

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

This should work.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top