Note that there are some explanatory texts on larger screens.

plurals
  1. POunwanted elements in the xml
    text
    copied!<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; @XStreamAsAttribute @XStreamImplicit 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.getChildItems()); //This is a List of all the child items </code></pre> <p>i get this as my output text </p> <pre><code>&lt;List&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;/List&gt; </code></pre> <p>whereas i want the output to be:</p> <pre><code>&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; </code></pre> <p>How do i get rid of the Initial List tag? any help is greatly appreciated.</p> <p>PS> This is a extension of the question i had asked a couple of weeks <a href="https://stackoverflow.com/questions/6838312/unwanted-elements-in-xml-via-xstream">back</a></p> <p>Can this be achieved by XSLT at all?</p>
 

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