1

I see VTD-XML parseGzip() loads the complete file into memory which is resulting in OutOfMemory.

My Eclipse -Xms20m and -Xmx100m and the Gzipped Xml file size is 50MB. Sample code i'm using is below, Any hits to get rid of memory constraints appreciated VTDGen vg = new VTDGen();

    isParsable = vg.parseGZIPFile(xmlFile, true);
    long loadingTime = System.nanoTime();
    System.out.println("read the file..");
    if (isParsable) {
        VTDNav vn = vg.getNav();
        AutoPilot ap = new AutoPilot(vn);
        ap.selectXPath("/records/record[bankbalance >100900]");
        i = -1;
        int j = 0;
        while ((i = ap.evalXPath()) != -1) {
            long l = vn.getElementFragment();
            byte[] bytes = vn.getXML().getBytes();

            fileOutputStream = new FileOutputStream(
                    "C:\\workspace\\TestFunc\\test\\out" + j + ".xml");
            fileOutputStream.write(bytes, (int) l, (int) (l >> 32));
            j++;
        }
vtd-xml-author
  • 3,319
  • 4
  • 22
  • 30

0 Answers0