I have the following xml file:
I would just use JAXB to bind data into set of objects that have structure similar to your XML document.
Something like:
@XmlRootElement("resources")
public class Resources {
public List resource = new ArrayList(); // important, can't be left null
}
public class Resource {
@XmlAttribute public String id;
public List property;
}
// and so on
one possible gotcha is regarding List serialization; there are two modes, wrapped and unwrapped; in your case, you want "unwrapped". Javadocs for annotations should show annotation to define this.