Looking at the XML and the DTD, I created the XSD of the structure:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="assets">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="asset"/>
<xs:element maxOccurs="unbounded" ref="total"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="asset">
<xs:complexType mixed="true">
<xs:attribute name="type" use="required" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="total">
<xs:complexType mixed="true">
<xs:attribute name="type" use="required" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>
Use xjc to generate the Java classes annotated with the JAXB binding annotations from the XSD. Then use the unmarshaller to unmarshal it to Java object.
Edit
Generated Java classes:
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlValue;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"asset",
"total"
})
@XmlRootElement(name = "assets")
public class Assets {
@XmlElement(required = true)
protected List<Asset> asset;
@XmlElement(required = true)
protected List<Total> total;
public List<Asset> getAsset() {
if (asset == null) {
asset = new ArrayList<Asset>();
}
return this.asset;
}
public List<Total> getTotal() {
if (total == null) {
total = new ArrayList<Total>();
}
return this.total;
}
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"content"
})
@XmlRootElement(name = "asset")
public class Asset {
@XmlValue
protected String content;
@XmlAttribute(required = true)
protected String type;
public String getContent() {
return content;
}
public void setContent(String value) {
this.content = value;
}
public String getType() {
return type;
}
public void setType(String value) {
this.type = value;
}
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"content"
})
@XmlRootElement(name = "total")
public class Total {
@XmlValue
protected String content;
@XmlAttribute(required = true)
protected String type;
public String getContent() {
return content;
}
public void setContent(String value) {
this.content = value;
}
public String getType() {
return type;
}
public void setType(String value) {
this.type = value;
}
}