title: Unexpected exception while parsing with XercesDOMParser
body: <p>I am using xerces-c-3.1.1-x86-windows-vc-10.0 to develop code in C++, using MS Developer Studio 10.0.4 on Windows 7 Professional SP1. I use the following code, from <a href="http://xerces.apache.org/xerces-c/program-sax-3.html" rel="nofollow noreferrer">here</a>, to open and close XML files.</p>
  
  <pre><code>try
  {
      XMLPlatformUtils::Initialize();
  }
  catch (const XMLException&amp; toCatch) 
  {
      char* message = XMLString::transcode(toCatch.getMessage());
      cout &lt;&lt; "Error during initialization! :\n"
              &lt;&lt; message &lt;&lt; "\n";
      XMLString::release(&amp;message);
      return ERROR_PARAMETERS;
  }
  
  // Determine xml file name
  xmlsFileName.assign(fileName);      
  
  XercesDOMParser* parser = new XercesDOMParser();
  parser-&gt;setValidationScheme(XercesDOMParser::Val_Always);
  parser-&gt;setDoNamespaces(true); 
  
  ErrorHandler* errHandler = (ErrorHandler*) new HandlerBase();
  parser-&gt;setErrorHandler(errHandler);
  
  try 
  {
      parser-&gt;parse(xmlsFileName.c_str());
  }
  catch (const XMLException&amp; toCatch) 
  {
      char* message = XMLString::transcode(toCatch.getMessage());
      cout &lt;&lt; "Exception message is: \n"
              &lt;&lt; message &lt;&lt; "\n";
      XMLString::release(&amp;message);
      return ERROR_PARAMETERS;
  }
  catch (const DOMException&amp; toCatch) 
  {
      char* message = XMLString::transcode(toCatch.msg);
      cout &lt;&lt; "Exception message is: \n"
              &lt;&lt; message &lt;&lt; "\n";
      XMLString::release(&amp;message);
      return ERROR_PARAMETERS;
  }
  catch (...) 
  {
      cout &lt;&lt; "Unexpected Exception \n" ;
      return ERROR_PARAMETERS;
  }
  
  // Some more code
  
  delete parser;
  delete errHandler;
  </code></pre>
  
  <p>The input XML files have the naming sequence <code>rootname-00000.xml</code>, <code>rootname-00001.xml</code>, etc.  Everything works fine until I get to <code>rootname-03799.xml</code> at which point</p>
  
  <pre><code>parser-&gt;parse(xmlsFileName.c_str());
  </code></pre>
  
  <p>fails with parser->parse(xmlsFileName.c_str());</p>
  
  <p>If I change its name to <code>rootname-00000.xml</code> I have no problems so it appears that there is no problem with the format of the file.  Also, I delete the parser and error handler every time so it seems that I should not be running out of anything.</p>
  
  <p>Any assistance with this problem would be greatly appreciated</p>