title: XML Parsing in java
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/23106/best-method-to-parse-various-custom-xml-documents-in-java">Best method to parse various custom XML documents in Java</a>  </p>
  </blockquote>
  
  
  
  <p>HI all,</p>
  
  <p>I am beginner to java. I hope the question I am asking may be easy one. My question is if I had an XML file and i want to parse it get the elements only with in specific tag.
  for example if XML file looks like..</p>
  
     
  
  <p></p>
  
  <pre><code>&lt;date&gt;2005-10-31&lt;/date&gt;
  &lt;number&gt;12345&lt;/number&gt;
  
  &lt;purchased-by&gt;
      &lt;name&gt;My name&lt;/name&gt;
      &lt;address&gt;My address&lt;/address&gt;
  &lt;/purchased-by&gt;
  
      &lt;order-items&gt;
  
      &lt;item&gt;
          &lt;code&gt;687&lt;/code&gt;
          &lt;type&gt;CD&lt;/type&gt;
          &lt;label&gt;Some music&lt;/label&gt;
      &lt;/item&gt;
  
      &lt;item&gt;
          &lt;code&gt;129851&lt;/code&gt;
          &lt;type&gt;DVD&lt;/type&gt;
          &lt;label&gt;Some video&lt;/label&gt;
      &lt;/item&gt;
  
  &lt;/order-items&gt;
  </code></pre>
  
  <p></p>
  
  <p>And from this XML I want to parse only the elements with in the tag name order-items.</p>
  
  <p>Is there any generic way to do this..?Please let me know..
  Thanks</p>