VTD-XML: The Future of XML Processing

SourceForge.net Logo

Sourceforge Home

Mailing Lists





2. How to Process XML

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

Users of VTD-XML often go through the following steps to process an XML document or message.

  1. Starting with a byte buffer: If the document resides on disk, one needs to first load the file in memory; for an incoming SOAP message, one needs to allocate a byte array to hold the content. Since version 1.6, one can directly use "VTDGen::parseFile()" to parse an XML file.

  2. Parsing using VTDGen: In this step, one creates an instance of VTDGen class, then assign the byte array to VTDGen object using "setDoc" member method. Afterwards, call "parse" to generate VTD buffers and hierarchical info.

  3. Navigation using VTDNav: If parsing returns no error, call "getNav" of VTDGen to retrieve the VTDNav object. The core navigation function is "toElement." It takes one of the six pre-defined integers to determine the actual navigation action. Those integers (self-explanatory) are: ROOT, PARENT, FIRST_CHILD, LAST_CHILD, NEXT_SIBLING and PREV_SIBLING. To reduce the amount of typing, those six constants also have short names: R, P, FC, LC, NS and PS. VTDNav also contains various member methods that perform VTD to string comparison, and convert VTD to String or numerical data. We provide a more detailed description of VTDNav in the next subsection.

  4. Node traversal using Autopilot: This class contains member methods that emulate DOM's node iterator. In the future, we will add XPath capabilities to it.

  5. XPath evaluation using AutoPilot: Starting from version 1.0, AutoPilot supports built-in XPath capabilities. 

  6. Incremental update using XMLModifier: Starting from version 1.8, VTD-XML introduces a new easy-to-use XML content change class called XMLModifer.

VTD in 30 seconds

VTD+XML Format

User's Guide

  0. Introduction

  1. Goals and Features

  2. How to Process XML

  3. Navigate VTD

  4. Classes/Interfaces and Methods

  5. Comparison with DOM, SAX, and Pull

 6. Table for Token Types

 7. The C version VTD-XML

Developer's Guide

VTD: A Technical Perspective

Code Samples


Getting Involved

Articles and Presentations