title: which xml validator will work perfectly for multithreading project
body: <p>I have used jdom for xml validation against schema. The main problem there is that it gives an error </p>
  
  <p>FWK005 parse may not be called while parsing</p>
  
  <p>The main reason was that multiple of threads working for xerces validation at the same time. SO I got the solution that i have to lock that validation. which is not good</p>
  
  <p>So I want to know which xml validator works perfectly for multithreading project</p>
  
  <pre><code>public static HashMap&lt;String, String&gt; validate(String xmlString, Validator validator) {
  
      HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
      long t1 = System.currentTimeMillis();
      DocumentBuilder builder = null;
      try {
          //obtain lock to proceed
  //         lock.lock();
  
          try {
              builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
  //                Source source = new DOMSource(builder.parse(new ByteArrayInputStream(xmlString.getBytes())));
  
              validator.validate(new StreamSource(new StringReader(xmlString)));
              map.put("ISVALID", "TRUE");
              logger.info("We have successfuly validated the schema");
          } catch (Exception ioe) {
              ioe.printStackTrace();
              logger.error("NOT2 VALID STRING IS :" + xmlString);
              map.put("MSG", ioe.getMessage());
              //         logger.error("IOException while validating the input XML", ioe);
          }
          logger.info(map);
          long t2 = System.currentTimeMillis();
          logger.info("XML VALIDATION TOOK:::" + (t2 - t1));
  
      } catch (Exception e) {
          logger.error(e);
      } finally {
          //release lock
  //         lock.unlock();
          builder = null;
      }
  
      return map;
  }
  </code></pre>
  
  <p>Thanks
  Sunil Kumar Sahoo</p>