title: How to convert XML to List<Object> using XStream without ROOT node
body: <p>I've XML response as follow. I want to skip the <code>GIA</code> (*all root node for other <code>XML</code> as well) node and get the <code>List&lt;Referenza&gt;</code> is it really possible using <code>XStream</code>?</p>
  
  <p><strong>XML</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;GIA&gt;
    &lt;Referenza&gt;
      &lt;GiaDat&gt;20150727&lt;/GiaDat&gt;
      &lt;GiaMag&gt;01&lt;/GiaMag&gt;
      &lt;GiaArt&gt;SK01-0500&lt;/GiaArt&gt;
      &lt;GiaDes&gt;KATSUOBUSHI POWDER 500G&lt;/GiaDes&gt;
      &lt;GiaLot&gt;&lt;/GiaLot&gt;
      &lt;GiaStm&gt;CF&lt;/GiaStm&gt;
      &lt;GiaQta&gt;88&lt;/GiaQta&gt;
      &lt;GiaImp&gt;0&lt;/GiaImp&gt;
      &lt;GiaCon&gt;88&lt;/GiaCon&gt;
    &lt;/Referenza&gt;
    &lt;Referenza&gt;
      &lt;GiaDat&gt;20150727&lt;/GiaDat&gt;
      &lt;GiaMag&gt;01&lt;/GiaMag&gt;
      &lt;GiaArt&gt;SK02-0500&lt;/GiaArt&gt;
      &lt;GiaDes&gt;Katsuobushi Flakes 500g&lt;/GiaDes&gt;
      &lt;GiaLot&gt;&lt;/GiaLot&gt;
      &lt;GiaStm&gt;CF&lt;/GiaStm&gt;
      &lt;GiaQta&gt;130&lt;/GiaQta&gt;
      &lt;GiaImp&gt;0&lt;/GiaImp&gt;
      &lt;GiaCon&gt;130&lt;/GiaCon&gt;
    &lt;/Referenza&gt;
    ...
    ...
  &lt;/GIA&gt;
  </code></pre>
  
  <p><strong>Referenza.java</strong></p>
  
  <pre><code>import com.thoughtworks.xstream.annotations.XStreamAlias;
  
  @XStreamAlias("Referenza")
  public class Referenza {
      private String GiaCon;
      private String GiaLot;
      private String GiaArt;
      private String GiaDes;
      private String GiaImp;
      private String GiaDat;
      private String GiaQta;
      private String GiaMag;
      private String GiaStm;
  
      // Getter-Setter
  }
  </code></pre>
  
  <p><strong>Test.java</strong></p>
  
  <pre><code>String strData = strBatch.toString(); //XML Data
  
  XStream xstream = new XStream(new DomDriver());
  xstream.alias("Referenza", Referenza.class);
  xstream.autodetectAnnotations(true);
  
  /* I want the List of Referenza */
  //List&lt;Referenza&gt; listReferenza = (List&lt;Referenza&gt;) xstream.fromXML(strData, Referenza.class);
  </code></pre>
  
  <p>If I execute above code then it throws an exception...</p>
  
  <pre><code>Exception in thread "main" com.thoughtworks.xstream.mapper.CannotResolveClassException: GIA
      at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:79)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:55)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.PackageAliasingMapper.realClass(PackageAliasingMapper.java:88)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAliasingMapper.java:79)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.ArrayMapper.realClass(ArrayMapper.java:74)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.SecurityMapper.realClass(SecurityMapper.java:71)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
      at com.thoughtworks.xstream.mapper.CachingMapper.realClass(CachingMapper.java:47)
      at com.thoughtworks.xstream.core.util.HierarchicalStreams.readClassType(HierarchicalStreams.java:29)
      at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:133)
      at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
      at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1206)
      at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1190)
      at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1120)
      at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1108)
      at com.org.openxcell.channel.orderhive.ftp.response.Test.main(Test.java:37)
  </code></pre>
  
  <hr>
  
  <p>Thanks to Jon Skeet following code worked for me.</p>
  
  <pre><code>XStream xstream = new XStream(new DomDriver());
  xstream.alias("GIA", List.class);
  xstream.alias("Referenza", Referenza.class);
  xstream.autodetectAnnotations(true);
  List&lt;Object&gt; list=  (List&lt;Object&gt;) xstream.fromXML(strData, new Referenza());
  </code></pre>