2 Replies Latest reply: May 2, 2007 10:31 AM by 807606 RSS

    DOM heap memory problem and Text element question

    807606
      Hi All,

      I have to parse LOADS (about 3000) of small XML (6k) files and have been using DOM parser... Unfortunately i get a Java Heap out of memory error and i dont know how to solve it... i know i can increase my memory usage but thats only a temporary solution and i was hoping for a better solution. The error occurs on this line: document[i] = builder.parse(fil);
       try {
                  File fil=null;
                  DocumentBuilder builder =null;
                  builder = factory.newDocumentBuilder();
                  for(int i=0;i<str.length;i++){                
                      fil= new File(str);
      document[i] = builder.parse(fil);
      fil=null;
      System.gc();
      }
      } catch (Exception sxe) {sxe.printStackTrace();  }



      can you suggest anything?

      the second probably simpler question that i have is: what constitutes a Text element i.e. which standard tags are assumed to be Text elements?


      Thanks for your help

      Message was edited by:
      Lila_harr

      Message was edited by:
      Lila_harr