I am new to XStream
I have following DTO
@XStreamAlias("outline")
public class OutlineItem implements java.io.Serializable {
private static final long serialVersionUID = -2321669186524783800L;
@XStreamAlias("text")
@XStreamAsAttribute
private String text;
@XStreamAlias("removeMe")
private List<OutlineItem> childItems;
}
once i do
XStream stream = new XStream();
stream.processAnnotations(OutlineItem.class);
stream.toXML(outlineItem);
i get this as my output text
<outline text="Test">
<removeMe>
<outline text="Test Section1">
<removeMe>
<outline text="Sub Section1 1">
<removeMe/>
</outline>
<outline text="Sub Section1 2">
<removeMe/>
</outline>
</removeMe>
</outline>
<outline text="Test Section 2">
<removeMe>
<outline text="Test Section2 1">
<removeMe/>
</outline>
</removeMe>
</outline>
</removeMe>
</outline>
whereas i want the output to be:
<outline text="Test">
<outline text="Test Section1">
<outline text="Sub Section1 1">
</outline>
<outline text="Sub Section1 2">
</outline>
</outline>
<outline text="Test Section 2">
<outline text="Test Section2 1">
</outline>
</outline>
</outline>
Any help will be greatly appreciated! Not sure if some kind of XSLT is required...
- Shah