Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How To Process Huge XML Documents Using Extended VTD-XML?

DZone's Guide to

How To Process Huge XML Documents Using Extended VTD-XML?

·
Free Resource
// description of your code here
This example shows you how to use extended VTD-XML and XPath to process XML documents bigger than 2GB. To use it, your application needs to include com.ximpleware.extended and be run within a 64-bit JVM.

/**
 * This is a demonstration of how to use the extended VTD parser
 * to process large XML file. You need 64-bit JVM to take full 
 * advantage of extended VTD.
 */
import com.ximpleware.extended.*;
public class mem_mapped_read {
	public static void main(String[] s) throws Exception{
	    VTDGenHuge vg = new VTDGenHuge();
	    if (vg.parseFile("test.xml",true,VTDGenHuge.MEM_MAPPED)){
	        VTDNavHuge vnh = vg.getNav();
		AutoPilotHuge aph = new AutoPilotHuge(vnh);
		aph.selectXPath("//*");
		int i = 0;
		while ((i=aph.evalXPath())!=-1){
			System.out.println(" element name is "+vnh.toString(i));
		}
	        
	    }
	}
}

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}