title: object to xml is not generated correctly by java in case of multiple objects
body: <p>As shown below, I have a POJO class with setters and getters:</p>
  
  <pre><code>public class InvoiceReferenceNotificationMessage  {
      private String InvoiceReference;
      private String ABSReference;
      private String Currency;
      private double InvoiceAmount;
      private double PaidAmount;
      private double BalanceAmount;
      private Date ValueDate;
      private String Remarks;
  }
  </code></pre>
  
  <p>and below is the class in which the above is being referenced: </p>
  
  <pre><code>public class Mail {
      @SuppressWarnings("unused")
      private  InvoiceReferenceNotificationMessage invoiceReferenceNotificationMessage;
  
      public InvoiceReferenceNotificationMessage getInvoiceReferenceNotificationMessage() {
          return invoiceReferenceNotificationMessage;
      }
  
      public void setInvoiceReferenceNotificationMessage(
              InvoiceReferenceNotificationMessage invoiceReferenceNotificationMessage) {
          this.invoiceReferenceNotificationMessage = invoiceReferenceNotificationMessage;
      }
  }
  </code></pre>
  
  <p>I am using xstream to generate the xml from the object. I have no problem creating a single object in java as shown below:</p>
  
  <pre><code>public class InvoiceReferenceNotificationMessagetest {
  
      InvoiceReferenceNotificationMessage invoiceReferenceNotificationMessage = new InvoiceReferenceNotificationMessage();
      invoiceReferenceNotificationMessage.setInvoiceReference("S15");
      invoiceReferenceNotificationMessage.setABSReference("IRMA1");
      invoiceReferenceNotificationMessage.setCurrency("GBP");
      invoiceReferenceNotificationMessage.setInvoiceAmount(25746);
      invoiceReferenceNotificationMessage.setPaidAmount(18245);
      invoiceReferenceNotificationMessage.setBalanceAmount(90);
      invoiceReferenceNotificationMessage.setValueDate(new Date());
      invoiceReferenceNotificationMessage.setRemarks("abc");
  
  
      Mail m = new Mail();
      m.setInvoiceReferenceNotificationMessage(invoiceReferenceNotificationMessage);
      XStream xstream = new XStream();
      xstream.alias("brokermail",Mail.class);
      String abc = xstream.toXML(m);
  }
  </code></pre>
  
  <p>The tags which I finally get is as shown below:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;brokermail&gt;
    &lt;invoiceReferenceNotificationMessage&gt;
      &lt;InvoiceReference&gt;dffg&lt;/InvoiceReference&gt;
      &lt;ABSReference&gt;Ifgfg&lt;/ABSReference&gt;
      &lt;Currency&gt;Ggfg&lt;/Currency&gt;
      &lt;InvoiceAmount&gt;2554546.0&lt;/InvoiceAmount&gt;
      &lt;PaidAmount&gt;125445.0&lt;/PaidAmount&gt;
      &lt;BalanceAmount&gt;0454.0&lt;/BalanceAmount&gt;
      &lt;ValueDate&gt;2015-:34.165 IST&lt;/ValueDate&gt;
      &lt;Remarks&gt;abc&lt;/Remarks&gt;
    &lt;/invoiceReferenceNotificationMessage&gt;
     &lt;invoiceReferenceNotificationMessage&gt;
      &lt;InvoiceReference&gt;xxRRR5&lt;/InvoiceReference&gt;
      &lt;ABSReference&gt;IRMAR15657311&lt;/ABSReference&gt;
      &lt;Currency&gt;EUR&lt;/Currency&gt;
      &lt;InvoiceAmount&gt;2545446.0&lt;/InvoiceAmount&gt;
      &lt;PaidAmount&gt;154245.0&lt;/PaidAmount&gt;
      &lt;BalanceAmount&gt;045.0&lt;/BalanceAmount&gt;
      &lt;ValueDate&gt;2015-05-20 21:34:34.165 IST&lt;/ValueDate&gt;
      &lt;Remarks&gt;abffc&lt;/Remarks&gt;
    &lt;/invoiceReferenceNotificationMessage&gt;
  &lt;/brokermail&gt;
  </code></pre>
  
  <p>but I have changed my mail class to store multiple objects in below fashion </p>
  
  <pre><code>public class Mail {
      private  List&lt;InvoiceReferenceNotificationMessage&gt; invoiceReferenceNotificationMessage = new ArrayList&lt;InvoiceReferenceNotificationMessage&gt;();
  
      public List&lt;InvoiceReferenceNotificationMessage&gt; getInvoiceReferenceNotificationMessages() {
          return invoiceReferenceNotificationMessage;
      }
  
      public void addInvoiceReferenceNotificationMessages(List&lt;InvoiceReferenceNotificationMessage&gt; invoiceReferenceNotificationMessages) {
          this.invoiceReferenceNotificationMessage = invoiceReferenceNotificationMessages;
      }
  }
  </code></pre>
  
  <p>now when I am creating the objects as shown below..</p>
  
  <pre><code>List&lt;InvoiceReferenceNotificationMessage&gt; invoiceReferenceNotificationMessagest = new ArrayList&lt;InvoiceReferenceNotificationMessage&gt;();
          invoiceReferenceNotificationMessagest.add(invoiceReferenceNotificationMessage);
          invoiceReferenceNotificationMessagest.add(invoiceReferenceNotificationMessage1);
  
          Mail m = new Mail();
          m.addInvoiceReferenceNotificationMessages(invoiceReferenceNotificationMessagest);
  
  XStream xstream = new XStream();
          xstream.alias("brokermail",Mail.class);
          String abc = xstream.toXML(m);
  </code></pre>
  
  <p>I am getting the tag as shown below:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;brokermail&gt;
    &lt;invoiceReferenceNotificationMessage&gt;
      &lt;com.jms.InvoiceReferenceNotificationMessage&gt;
        &lt;InvoiceReference&gt;SM/829743434309/0315&lt;/InvoiceReference&gt;
        &lt;RBSReference&gt;IRMAR34343157311&lt;/RBSReference&gt;
        &lt;Currency&gt;GBP&lt;/Currency&gt;
        &lt;InvoiceAmount&gt;23434546.0&lt;/InvoiceAmount&gt;
        &lt;PaidAmount&gt;124345.0&lt;/PaidAmount&gt;
        &lt;BalanceAmount&gt;0.0&lt;/BalanceAmount&gt;
        &lt;ValueDate&gt;2015-05-21 17:51:26.188 IST&lt;/ValueDate&gt;
        &lt;Remarks&gt;abc&lt;/Remarks&gt;
      &lt;/com.jms.InvoiceReferenceNotificationMessage&gt;
      &lt;com.rbsfm.ice.ioa.jms.InvoiceReferenceNotificationMessage&gt;
        &lt;InvoiceReference343&gt;SM/4315&lt;/InvoiceReference&gt;
        &lt;RBSReference&gt;I157311&lt;/RBSReference&gt;
        &lt;Currency&gt;EUR&lt;/Currency&gt;
        &lt;InvoiceAmount&gt;2554546.0&lt;/InvoiceAmount&gt;
        &lt;PaidAmount&gt;12543545.0&lt;/PaidAmount&gt;
        &lt;BalanceAmount&gt;0.0&lt;/BalanceAmount&gt;
        &lt;ValueDate&gt;2015-05-21 17:51:26.188 IST&lt;/ValueDate&gt;
        &lt;Remarks&gt;abERRc&lt;/Remarks&gt;
      &lt;/com.jms.InvoiceReferenceNotificationMessage&gt;
    &lt;/invoiceReferenceNotificationMessage&gt;
  &lt;/brokermail&gt;
  </code></pre>
  
  <p>Which is not correct as I am looking for the below one should come please advise how to achieve this.</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;brokermail&gt;
    &lt;invoiceReferenceNotificationMessage&gt;
      &lt;InvoiceReference&gt;AA/54545829709/0315&lt;/InvoiceReference&gt;
      &lt;RBSReference&gt;IRMA4545R157311&lt;/RBSReference&gt;
      &lt;Currency&gt;GBP&lt;/Currency&gt;
      &lt;InvoiceAmount&gt;255446.0&lt;/InvoiceAmount&gt;
      &lt;PaidAmount&gt;124545.0&lt;/PaidAmount&gt;
      &lt;BalanceAmount&gt;0.0&lt;/BalanceAmount&gt;
      &lt;ValueDate&gt;2015-05-20 21:34:34.165 IST&lt;/ValueDate&gt;
      &lt;Remarks&gt;abc&lt;/Remarks&gt;
    &lt;/invoiceReferenceNotificationMessage&gt;
     &lt;invoiceReferenceNotificationMessage&gt;
      &lt;InvoiceReference&gt;xx/8245459709/0315&lt;/InvoiceReference&gt;
      &lt;RBSReference&gt;IRMAR545157311&lt;/RBSReference&gt;
      &lt;Currency&gt;GBP&lt;/Currency&gt;
      &lt;InvoiceAmount&gt;2545456.0&lt;/InvoiceAmount&gt;
      &lt;PaidAmount&gt;124455.0&lt;/PaidAmount&gt;
      &lt;BalanceAmount&gt;0.0&lt;/BalanceAmount&gt;
      &lt;ValueDate&gt;2015-05-20 21:34:34.165 IST&lt;/ValueDate&gt;
      &lt;Remarks&gt;abc&lt;/Remarks&gt;
    &lt;/invoiceReferenceNotificationMessage&gt;
  &lt;/brokermail&gt; 
  </code></pre>
  
  <p>As you can see the below tag is </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;com.jms.InvoiceReferenceNotificationMessage&gt;
  </code></pre>
  
  <p>is extra which I do not require, please advise me on how to overcome this.</p>