title: java class representation of xml
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/428073/what-is-the-best-simplest-way-to-read-in-an-xml-file-in-java-application">What is the best/simplest way to read in an XML file in Java application?</a>  </p>
  </blockquote>
  
  
  
  <p>I have an xml like this:</p>
  
  <pre><code>&lt;Root&gt;
     &lt;Commodity&gt;
         &lt;Which name="Book" /&gt;
         &lt;Book name="harley" price="5" /&gt;
         &lt;Book name="Marley" price="8" /&gt;
         &lt;Book name="hampi" price="10" /&gt;
     &lt;/Commodity&gt;
     &lt;Item&gt;
        &lt;Commodity&gt;
           &lt;Which name="fiction" /&gt;
           &lt;Book name="harley" price="5" /&gt;
           &lt;Book name="Marley" price="8" /&gt;
           &lt;Book name="hampi" price="10" /&gt;
        &lt;/Commodity&gt;
        &lt;Item&gt;
           &lt;Commodity&gt;
              &lt;Which name="thriller" /&gt;
              &lt;Book name="hjhj" price="5" /&gt;
              &lt;Book name="ccvcv" price="8" /&gt;
              &lt;Book name="vcvnnn" price="10"/&gt;
           &lt;/Commodity&gt;
        &lt;/Item&gt;
     &lt;/Item&gt;
  &lt;/Root&gt;
  </code></pre>
  
  <p>I feel that this is a pretty complex xml structure since it has a nested tag. is there a way around to generate java class for the structure?</p>