Note that there are some explanatory texts on larger screens.

plurals
  1. POUnwanted elements in XML via XSTREAM
    text
    copied!<p>I am new to XStream</p> <p>I have following DTO</p> <pre><code>@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&lt;OutlineItem&gt; childItems; } </code></pre> <p>once i do </p> <pre><code>XStream stream = new XStream(); stream.processAnnotations(OutlineItem.class); stream.toXML(outlineItem); </code></pre> <p>i get this as my output text </p> <pre><code>&lt;outline text="Test"&gt; &lt;removeMe&gt; &lt;outline text="Test Section1"&gt; &lt;removeMe&gt; &lt;outline text="Sub Section1 1"&gt; &lt;removeMe/&gt; &lt;/outline&gt; &lt;outline text="Sub Section1 2"&gt; &lt;removeMe/&gt; &lt;/outline&gt; &lt;/removeMe&gt; &lt;/outline&gt; &lt;outline text="Test Section 2"&gt; &lt;removeMe&gt; &lt;outline text="Test Section2 1"&gt; &lt;removeMe/&gt; &lt;/outline&gt; &lt;/removeMe&gt; &lt;/outline&gt; &lt;/removeMe&gt; &lt;/outline&gt; </code></pre> <p>whereas i want the output to be:</p> <pre><code>&lt;outline text="Test"&gt; &lt;outline text="Test Section1"&gt; &lt;outline text="Sub Section1 1"&gt; &lt;/outline&gt; &lt;outline text="Sub Section1 2"&gt; &lt;/outline&gt; &lt;/outline&gt; &lt;outline text="Test Section 2"&gt; &lt;outline text="Test Section2 1"&gt; &lt;/outline&gt; &lt;/outline&gt; &lt;/outline&gt; </code></pre> <p>Any help will be greatly appreciated! Not sure if some kind of XSLT is required...</p> <ul> <li>Shah</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload