title: With MOXy and XPath, is it possible to unmarshal two lists of attributes?
body: <p>Note, this is not a duplicate of another question I asked, "<a href="https://stackoverflow.com/questions/6907225/with-moxy-and-xpath-is-it-possible-to-unmarshal-a-list-of-attributes">With MOXy and XPath, is it possible to unmarshal a list of attributes?</a>"  It's similar, but not the same.</p>
  
  <p>I've got XML that looks like this:
  </p>
  
  <pre><code>&lt;test&gt;
    &lt;items&gt;
      &lt;item type="cookie" brand="oreo"&gt;cookie&lt;/item&gt;
      &lt;item type="crackers" brand="ritz"&gt;crackers&lt;/item&gt;
    &lt;/items&gt;
  &lt;/test&gt;
  </code></pre>
  
  <p>This is similar to the xml in my earlier question except now there are two attributes per item instead of one.</p>
  
  <p>In my class:
  </p>
  
  <pre><code>@XmlPath("items/item/@type")
  @XmlAttribute
  private ArrayList&lt;String&gt; itemList = new ArrayList&lt;String&gt;();
  @XmlPath("items/item/@brand")
  @XmlAttribute
  private ArrayList&lt;String&gt; brandList = new ArrayList&lt;String&gt;();
  </code></pre>
  
  <p>Thanks to the answer to my previous question I am able to unmarshal the <code>type</code> attribute into the list.  <code>brandList</code>, however, is empty.  If I comment out annotations for <code>itemList</code> (so it is not populated by JAXB/MOXy) then <code>brandList</code> contains the correct values.</p>
  
  <p>It appears that I can only unmarshal a single attribute into a list using XPath.  Is this by design or have I configured something wrong?</p>
  
  <p><strong>Update:</strong> It seems I can't unmarshal the text and an attribute from an element either.  If my class is mapped like this:</p>
  
  <pre class="lang-java prettyprint-override"><code>@XmlPath("items/item/text()")
  @XmlElement
  private ArrayList&lt;String&gt; itemList = new ArrayList&lt;String&gt;();
  @XmlPath("items/item/@brand")
  @XmlAttribute
  private ArrayList&lt;String&gt; brandList = new ArrayList&lt;String&gt;();
  </code></pre>
  
  <p><code>brandList</code> is also empty in this case.  If I switch the order and map <code>brandList</code> first then <code>itemList</code> is empty.  It's as if the first mapping consumes the element so further values based on that element or its attributes cannot be read.</p>