title: can you convert a jaxb object to org.w3c.dom.Element?
body: <p>I got some .xsd files from another department that doesn't use Java. I need to write xml that corresponds to the specified format. So I jaxb-converted them to Java classes and I'm able to write some of the xml. So far so good. But now one of the element/classes contains a property where you can (/you're supposed to be able to) insert any xml. I need to insert one of the other jaxb elements there.</p>
  
  <p>In java, we have:</p>
  
  <pre><code>import org.w3c.dom.Element;
  ...
          @XmlAccessorType(XmlAccessType.FIELD)
          @XmlType(name = "", propOrder = {
              "any"
          })
          public static class XMLDocument {
  
              @XmlAnyElement
              protected Element any;
  
              /**
               * Gets the value of the any property.
               * 
               * @return
               *     possible object is
               *     {@link Element }
               *     
               */
              public Element getAny() {
                  return any;
              }
  
              /**
               * Sets the value of the any property.
               * 
               * @param value
               *     allowed object is
               *     {@link Element }
               *     
               */
              public void setAny(Element value) {
                  this.any = value;
              }
  
          }
  </code></pre>
  
  <p>And the object I want to insert, is of this class:</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "", propOrder = {
      "contactInfo",
      ...
  })
  @XmlRootElement(name = "Letter")
  public class Letter {
  
      @XmlElement(name = "ContactInfo", required = true)
      protected ContactInformationLetter contactInfo;
      ...
  </code></pre>
  
  <p>I was hoping I could do something like this:</p>
  
  <pre><code>Letter letter = new Letter();
  
  XMLDocument xmlDocument = new XMLDocument();
  xmlDocument.setAny(letter);
  </code></pre>
  
  <p>But of course letter is not of type "Element".</p>