VTD-XML: The Future of XML Processing

SourceForge.net Logo

Sourceforge Home

Mailing Lists

XimpleWare

Download


VTD-XML Home

 

Index Creation and Loading

(For more code samples, visit Official VTD-XML Blog)

(Separate code-only VTD-XML tutorials are available in C, C++, Java and C#)

This example has two applications that respectively generate VTD+XML index for XML, and load VTD+XML index (thus bypass parsing). Those application are pretty short, and they are available here:

createIndex.java

loadIndex.java

Here is the code for creating VTD+XML index. The recommended output suffix for the index is ".vxl" so the index for "input.xml" is "input.vxl."

// createIndex creates a VTD+XML index for an input XML document

import com.ximpleware.*;
import java.io.*;
public class createIndex {
      public static void main(String[] args) throws Exception{
                     VTDGen vg = new VTDGen();
                     if (args.length != 2)
                             throw new Exception("Invalid # of arguments");

                     String inputName = args[0];
                     String outputName = args[1];

                     if (vg.parseFile(inputName,true)){
                        vg.writeIndex(new FileOutputStream(outputName));
                     }
       }
}

 

Here is the code for loading the index.

// loadIndex.java loads a VTD+XML index file into memory

import java.io.*;
import com.ximpleware.*;
public class loadIndex {
         public static void main(String[] args) throws IOException,IndexReadException {
                 VTDGen vg = new VTDGen();
                 VTDNav vn = vg.loadIndex(args[0]);
                // put the processing logic here
        }
}

VTD in 30 seconds

VTD+XML Format

User's Guide

Developer's Guide

VTD: A Technical Perspective

Code Samples

  RSS Reader in Java

  RSS Reader in C

  SOAP in Java

  SOAP in C

  BioInfo in Java

  BioInfo in C

  XMLModifier In Java

  XMLModifier In C 

  Shuffle

  Edit XML

  Index Creation and Loading

  Process Huge XML Files (>2G)

FAQ

Getting Involved

Articles and Presentations

Benchmark

API Doc

Demo