title: Parsing using SAXParserFactory with multiple threads
body: <p>I have to parse a given xml file using SAX parser.
  This xml file contains data which would be parsed using multiple default handlers.
  First parser will parse some information, second will parse some other information and so on... from the same file.</p>
  
  <p>The above process may be running in multiple threads i.e. multiple xml files and multiple parsers per xml file.</p>
  
  <p>So, if i have 5 xml files and 5 handlers. Then there would be 5*5 = 25 processes running parallely.</p>
  
  <p>Now, <code>SAXParserFactory</code> is not thread safe.</p>
  
  <p><strong><em>So, do i have to do the following for each thread ?</em></strong></p>
  
  <pre><code>SAXParserFactory factory = SAXParserFactory.newInstance();
  SAXParser parser = factory.newSAXParser();
  </code></pre>
  
  <p>OR can i use same parser object for a given xml for all the handlers in which case i will have 5 parsers (one per xml).
  But i am not sure if that would work.</p>