title: Parsing complex xml to java using jaxb
body: <p>Can anyone suggest a piece of code, for converting xml to java using jaxb.
  My xml file look like </p>
  
  <pre><code>     &lt;Customer&gt;
      &lt;Operation&gt;Sample&lt;/Operation&gt;
      &lt;head&gt;
          &lt;sub&gt;
              &lt;value&gt;
                  &lt;att&gt;
                      &lt;req&gt;
                          &lt;name&gt;sample&lt;/name&gt;
                          &lt;value&gt;
                              &lt;string&gt; sample values &lt;/string&gt;
                          &lt;/value&gt;
                      &lt;/req&gt;
                  &lt;/att&gt;
              &lt;/value&gt;
          &lt;/sub&gt;
          &lt;sub&gt;
              &lt;value&gt;
                  &lt;att&gt;
                      &lt;req&gt;
                          &lt;name&gt;var&lt;/name&gt;
                          &lt;value&gt;
                              &lt;string&gt;var value&lt;/string&gt;
                          &lt;/value&gt;
                      &lt;/req&gt;
                  &lt;/att&gt;
              &lt;/value&gt;
          &lt;/sub&gt;
      &lt;/head&gt;
  &lt;/Customer&gt;
  </code></pre>
  
  <p>I used the following piece of code, but i am getting null values</p>
  
  <pre><code>File file = new File("C:\\xml.xml");
  JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class);
  Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
  Customer customer = (Customer) jaxbUnmarshaller.unmarshal(file);
  System.out.println(customer.name);
  System.out.println(customer.string);
  </code></pre>
  
  <p>My expected output should be like</p>
  
  <pre><code>Sample
  sample values
  var
  var value
  </code></pre>