I use JAXB to create folder and files hierarchy
My model:
@XmlRootElement
public class Root {
@XmlAttribute
private String path;
@XmlE
In your Dir
class you are not specifying the type of your collection this is why JAXB is adding the xsi:type
attributes.
You have:
@XmlElement(name = "dir")
private ArrayList dirs;
If your ArrayList
is going to contain instances of Dir
then you can do:
@XmlElement(name = "dir")
private ArrayList<Dir> dirs = null;
If for some reason you don't want to specify the type on the collection then you can do it in the @XmlElement
annotation:
@XmlElement(name = "dir", type=Dir.class)
private ArrayList dirs = null;