title: XStream parse attributes and values at the same time
body: <p>I have the following XML</p>
  
  <pre><code>&lt;search ver="3.0"&gt;
      &lt;loc id="ARBA0009" type="1"&gt;Buenos Aires, Argentina&lt;/loc&gt;
      &lt;loc id="BRXX1283" type="1"&gt;Buenos Aires, Brazil&lt;/loc&gt;
      &lt;loc id="ARDF0127" type="1"&gt;Aeroparque Buenos Aires, Argentina&lt;/loc&gt;
      &lt;loc id="MXJO0669" type="1"&gt;Concepcion De Buenos Aires, Mexico&lt;/loc&gt;
      &lt;loc id="MXPA1785" type="1"&gt;San Nicolas De Buenos Aires, Mexico&lt;/loc&gt;
      &lt;loc id="ARBA0005" type="1"&gt;Balcarce, Argentina&lt;/loc&gt;
      &lt;loc id="ARBA0008" type="1"&gt;Bragado, Argentina&lt;/loc&gt;
      &lt;loc id="ARBA0010" type="1"&gt;Campana, Argentina&lt;/loc&gt;
      &lt;loc id="ARBA0016" type="1"&gt;Chascomus, Argentina&lt;/loc&gt;
      &lt;loc id="ARBA0019" type="1"&gt;Chivilcoy, Argentina&lt;/loc&gt;
  &lt;/search&gt;
  </code></pre>
  
  <p>And a City class</p>
  
  <pre><code>public class City {
  
      private String  id;
      private Integer type;
      private String  name;
  
      // getters &amp; setters...
  }
  </code></pre>
  
  <p>I tried the following aliases to parse the XML</p>
  
  <pre><code>xStream.alias("search", List.class);
  xStream.alias("loc", City.class);
  xStream.useAttributeFor("id", String.class);
  xStream.useAttributeFor("type", Integer.class);
  </code></pre>
  
  <p>But I can't figure out how to set the value of the "loc" tag, if I try to transform the City object in XML I get</p>
  
  <pre><code>&lt;search&gt;
      &lt;loc id="ARBA0001" type="1"&gt;
          &lt;name&gt;Buenos Aires&lt;/name&gt;
      &lt;/loc&gt;
  &lt;/search&gt;
  </code></pre>
  
  <p>When I really need to get this</p>
  
  <pre><code>&lt;search&gt;
      &lt;loc id="ARBA0001" type="1"&gt;Buenos Aires&lt;/loc&gt;
  &lt;/search&gt;
  </code></pre>
  
  <p>Then, if I try to parse the XML to a City object I get the field "name" with a null value.</p>
  
  <p>Anybody knows how to set te correct aliases to do this? Thanks in advance.</p>