title: Out of Memory Error in XML Parsing
body: <p>I am facing "java.lang.OutOfMemoryError: JAVA Heap Space" error while parsing an XML file whose size is more than 350 MB.</p>
  
  <p>PFB the Code Snippet:</p>
  
  <pre><code>File file = new File("D:\WS\data.xml");
  InputSource source = new InputSource(new FileInputStream(file));
  XPathFactory xPathFact = XPathFactory.newInstance();
  XPath xPath = xPathFact.newXPath();
  XPathExpression expr = xPath.compile("//person");
  NodeList nodeList = (NodeList)expr.evaluate(source, XPathConstants.NODESET);
  </code></pre>
  
  <p>I am getting error at the last line where it is trying to evaluate.</p>