24

I'm using simple xml library: http://simple.sourceforge.net/home.php

I have a problem with @ElementList annotation: if I use this annotation like this:

@ElementList
protected List<Element> elements;

My XML file has one more attribute:

<elements class="java.util.ArrayList">

how to remove the attribute class="....." ?

quietmint
  • 13,885
  • 6
  • 48
  • 73
user1610075
  • 1,583
  • 3
  • 15
  • 32

1 Answers1

39

The class Attribute tells Simple which implementation of List you use. If it's missing, Simple will look for a proper class itself.

One solution is to use ArrayList instead of List:

@ElementList
protected ArrayList<Element> elements;

Now Simple wont add the class-Attribute.

Another way:

@Path("elements")
@ElementList(inline=true)
protected List<Element> elements;

This inlines your List (no elements-Tag is used) but puts it into a "new" elements-Tag

ollo
  • 24,797
  • 14
  • 106
  • 155