title: JAXB marshalling object having property of type List<Element> (@XmlAnyElement) doesnt output node value
body: <p>Following file TPAExtensionsType.java I have generated from a XSD file. </p>
  
  <p><b>TPAExtensionsType.java</b></p>
  
  <pre><code>/* 
   * &lt;p&gt;The following schema fragment specifies the expected content contained within this class.
   * 
   * &lt;pre&gt;
   * &amp;lt;complexType name="TPA_Extensions_Type"&gt;
   *   &amp;lt;complexContent&gt;
   *     &amp;lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
   *       &amp;lt;sequence&gt;
   *         &amp;lt;any processContents='skip' maxOccurs="unbounded" minOccurs="0"/&gt;
   *       &amp;lt;/sequence&gt;
   *     &amp;lt;/restriction&gt;
   *   &amp;lt;/complexContent&gt;
   * &amp;lt;/complexType&gt;
   * &lt;/pre&gt;
   * 
   * 
   */ 
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "TPA_Extensions_Type", propOrder = {
      "any"
  })
  @XmlRootElement 
  public class TPAExtensionsType {
  
      @XmlAnyElement
      protected List&lt;Element&gt; any;
  
      /**
       * Gets the value of the any property.
       * 
       * &lt;p&gt;
       * This accessor method returns a reference to the live list,
       * not a snapshot. Therefore any modification you make to the
       * returned list will be present inside the JAXB object.
       * This is why there is not a &lt;CODE&gt;set&lt;/CODE&gt; method for the any property.
       * 
       * &lt;p&gt;
       * For example, to add a new item, do as follows:
       * &lt;pre&gt;
       *    getAny().add(newItem);
       * &lt;/pre&gt;
       * 
       * 
       * &lt;p&gt;
       * Objects of the following type(s) are allowed in the list
       * {@link Element }
       * 
       * 
       */
      public List&lt;Element&gt; getAny() {
      if (any == null) {
          any = new ArrayList&lt;Element&gt;();
      }
      return this.any;
      }
  
  }
  </code></pre>
  
  <p>Following is the standalone application to marshall the above object to XML.</p>
  
  <p>TestUtil.java</p>
  
  <pre><code>public class TestUtil {
      public static void main(String[] args) {
          TPAExtensionsType tpaExtensions = new TPAExtensionsType();
          Element consumerInfo = new DOMElement("ConsumerInfo");
          consumerInfo.setNodeValue("Some Info");
          tpaExtensions.getAny().add(consumerInfo);
  
          StringWriter sw  = new StringWriter();
          JAXBContext context;
          try {
              context = JAXBContext.newInstance(TPAExtensionsType.class);
              Marshaller marshaller = context.createMarshaller();
              marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
              marshaller.marshal(tpaExtensions, sw);
              System.out.println(sw.toString());
          } catch (JAXBException e) {
              e.printStackTrace();
          }
  
      }
  }
  </code></pre>
  
  <p>Following is the output:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;tpaExtensionsType xmlns="SOME_NAMESPACE_ HERE"&gt;
      &lt;ConsumerInfo xmlns="" xmlns:ns2="SOME_NAMESPACE_ HERE"/&gt;
  &lt;/tpaExtensionsType&gt;
  </code></pre>
  
  <p>Problem I am facing:  </p>
  
  <p>The node <b>ConsumerInfo</b> has been created but its value is not visible in the generated XML though I have set its value in my standalone application above.Can anybody please help me getting this fixed and what is causing this problem?</p>