title: Unmarshalling xml with JAXB - namespace with XmlType and proporder
body: <p>I'm trying to unmarshal an xml file using JAXB. When I am using @XmlElement with the correct name and namespace the unmarshalling works (e.g. @XmlElement(name = "name", namespace="http://www.test.com"))</p>
  
  <p>If I use XmlType together with propOrder it unfortunately does not anymore (e.g. @XmlType(namespace="http://www.test.com", name = "", propOrder = {"name", "description"})).</p>
  
  <p>The content of the xml file (test.xml):</p>
  
  <pre><code>&lt;Operation xmlns="http://www.test.com"&gt;
    &lt;Parameter&gt;
      &lt;name&gt;Param1&lt;/name&gt;
      &lt;description&gt;Description of Parameter1&lt;/description&gt;
    &lt;/Parameter&gt;
    &lt;Parameter&gt;
      &lt;name&gt;Param2&lt;/name&gt;
      &lt;description&gt;Description of Parameter2&lt;/description&gt;
    &lt;/Parameter&gt;
  &lt;/Operation&gt;
  </code></pre>
  
  <p>The content of JAXBExample.java is:</p>
  
  <pre><code>package stackoverflow.problem.jaxb.ns;
  
  import java.io.FileNotFoundException;
  import java.io.FileReader;
  
  import javax.xml.bind.JAXBContext;
  import javax.xml.bind.JAXBException;
  import javax.xml.bind.Unmarshaller;
  
  public class JAXBExample {
  
    public static void main(String[] args) throws JAXBException, FileNotFoundException   {
    String xmlFilename = "test.xml";
  
      JAXBContext context = JAXBContext.newInstance(Operation.class);
  
      System.out.println("Output from our XML File: ");
      Unmarshaller um = context.createUnmarshaller();
      Operation op = (Operation) um.unmarshal(new FileReader(xmlFilename));
  
      System.out.println("Operation-Content: " + op);
    }
  
  }
  </code></pre>
  
  <p>The content of </p>
  
  <p>package stackoverflow.problem.jaxb.ns;</p>
  
  <pre><code>import java.util.List;
  
  import javax.xml.bind.annotation.XmlAccessType;
  import javax.xml.bind.annotation.XmlAccessorType;
  import javax.xml.bind.annotation.XmlElement;
  import javax.xml.bind.annotation.XmlRootElement;
  
  
  @XmlRootElement(name="Operation", namespace="http://www.test.com")
  @XmlAccessorType(XmlAccessType.FIELD)
  
  public class Operation {
  
    @XmlElement(name = "Parameter", namespace="http://www.test.com")
    List&lt;Parameter&gt; parameterList;
  
    @Override
    public String toString(){
      String retVal = "";
      for(Parameter currentParameter: parameterList){
        retVal += currentParameter.toString() + "\n";
      }   
      return retVal;
    }
  }
  </code></pre>
  
  <p>And the Content of Parameter.java is:</p>
  
  <pre><code>package stackoverflow.problem.jaxb.ns;
  
  import javax.xml.bind.annotation.XmlAccessType;
  import javax.xml.bind.annotation.XmlAccessorType;
  import javax.xml.bind.annotation.XmlElement;
  import javax.xml.bind.annotation.XmlRootElement;
  import javax.xml.bind.annotation.XmlType;
  
  @XmlType(namespace="http://www.test.com", name = "", propOrder = {"name", "description"})
  @XmlAccessorType(XmlAccessType.FIELD)
  public class Parameter {
  
    //@XmlElement(name = "name", namespace="http://www.test.com")
    String name;
  
    //@XmlElement(name = "description", namespace="http://www.test.com")
    String description;
  
    @Override
    public String toString(){
      return this.name + "\t" + this.description;
    }
  }
  </code></pre>
  
  <p>If I uncomment the two @XmlElement lines in the last code block (Parameter.java), the unmarshalling works fine. If those two lines are not included, both fields in the Parameter object are null. Is there another way to declare a namespace when using propOrder in XmlType? Or did I do something else wrong?</p>