title: Which parser: SAX, DOM or xpath?
body: <p>I have xml on which I run queries as stated below. Which parser (sax or DOM or xpath) is best to retrieve query node by id? </p>
  
  <p>Can you please explain me this with some sample code so that this will help me a lot?</p>
  
  <p>I want to write a generic class which reads queries by id and passes parameters to it. What is the best way to return values after we executing queries since every query may return a different set of values?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;queries&gt;
      &lt;query id="getUserByName"&gt;
          select * from users where name=?
      &lt;/query&gt;
      &lt;query id="getUserByEmail"&gt;
          select * from users where email=?
      &lt;/query&gt;
  &lt;/queries&gt;
  </code></pre>