I have an XML which is something similar to below,
<STANDARD id="1234">
<TOPIC id="111" state_num="ABC111">Reading
<TOPIC topicId="222" parent_id="111">Key Ideas and Details</TOPIC>
<TOPIC topicId="333" parent_id="111">Key values</TOPIC>
</TOPIC>
</STANDARD>
Java Object Similar to below,
@XStreamAlias("STANDARD")
public class STANDARD {
@XStreamAsAttribute
protected String id;
@XStreamImplicit
protected List<MSS.STANDARD.TOPIC> topic;
@XStreamAlias("TOPIC")
@XStreamConverter(value=ToAttributedValueConverter.class, strings={"value"})
public static class TOPIC {
@XStreamAsAttribute
protected String topicId;
@XStreamAsAttribute
protected String parent_id;
@XStreamAsAttribute
protected String value;
@XStreamImplicit
protected List<STANDARD.TOPIC> topic;
}
}
Am facing issues in the following,
The attribute which has an "_" key, ie parent_id is not being parsed.
The values for TOPIC is parsed if I use the XStreamConverter annotation, but the sub TOPIC elements which are present inside TOPIC is not being parsed.
If i remove the XStreamConverter annotation am able to get the Sub Topics parsed by adding Implicit Annotation. But I would like to parse the values as well as the sub elements at the same time.
Solution for 1. :