title: How to get the value of a specific XML tag using StaX
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/12061125/how-to-use-stax">How to use StaX</a>  </p>
  </blockquote>
  
  
  
  <p>Hey guys so I have an XML file and I want Java to spit out the value of a specific tag. For example here is my XML: </p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
      &lt;dennis&gt;
          &lt;hair&gt;brown&lt;/hair&gt;
          &lt;pants&gt;blue&lt;/pants&gt;
          &lt;gender&gt;male&lt;/gender&gt;
      &lt;/dennis&gt;
  </code></pre>
  
  <p>So let's say I want Java to spit out the value of "gender" is there code I could use like </p>
  
  <pre><code>XMLStreamReader.goToTag("gender");
  System.out.println(XMLStreamReader.getLocalName());
  </code></pre>