VTD-XML

Uses your system voice; voice and rate in settings.

Q7907612Snapshot

≈ 5 min read

Names in other languages

  • caVTD-XML
  • DeutschVTD-XML
  • EnglishVTD-XML
  • EspañolVTD-XML
  • FrançaisVTD-XML
  • ItalianoVTD-XML
  • PortuguêsVTD-XML
  • RomânăVTD-XML

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

Virtual Token Descriptor for eXtensible Markup Language (VTD-XML) refers to a collection of cross-platform XML processing technologies centered on a non-extractive XML, "document-centric" parsing technique called Virtual Token Descriptor (VTD). Depending on the perspective, VTD-XML can be viewed as one of the following: *A "Document-Centric" XML parser *A native XML indexer or a file format that uses binary data to enhance the text XML *An incremental XML content modifier *An XML slicer/splitter/assembler *An XML editor/eraser *A way to port XML processing on chip *A non-blocking, stateless XPath evaluator VTD-XML is developed by XimpleWare and dual-licensed under GPL and proprietary license. It was originally written in Java, but is now available in C, C++ and C#.

Virtual Token Descriptor for eXtensible Markup Language (VTD-XML) refers to a collection of cross-platform XML processing technologies centered on a non-extractive XML, "document-centric" parsing technique called Virtual Token Descriptor (VTD). Depending on the perspective, VTD-XML can be viewed as one of the following: A "Document-Centric" XML parser A native XML indexer or a file format that uses binary data to enhance the text XML An incremental XML content modifier An XML slicer/splitter/assembler An XML editor/eraser A way to port XML processing on chip A non-blocking, stateless XPath evaluator VTD-XML is developed by XimpleWare and dual-licensed under GPL and proprietary license. It was originally written in Java, but is now available in C, C++ and C#.

Basic concept

Non-extractive, document-centric parsing

Traditionally, a lexical analyzer represents tokens (the small units of indivisible character values) as discrete string objects. This approach is designated extractive parsing. In contrast, non-extractive tokenization mandates that one keeps the source text intact, and uses offsets and lengths to describe those tokens.

Virtual token descriptor

Virtual Token Descriptor (VTD) applies the concept of non-extractive, document-centric parsing to XML processing. A VTD record uses a 64-bit integer to encode the offset, length, token type and nesting depth of a token in an XML document. Because all VTD records are 64 bits in length, they can be stored efficiently and managed as an array.

Overview

Virtually all the core benefits of VTD-XML are inherent to non-extractive, document-centric parsing which provides these characteristics: The source XML text is kept intact in memory without decoding. The internal representation of VTD-XML is inherently persistent. Obviates object-oriented modeling of the hierarchical representation as it relies entirely on primitive data types (e.g., 64-bit integers) to represent the XML hierarchy, thus reducing object creation cost to nearly zero. Combining those characteristics permits thinking of XML purely as syntax (bits, bytes, offsets, lengths, fragments, namespace-compensated fragments, and document composition) instead of the serialization/deserialization of objects. This is a powerful way to think about XML/SOA applications.

As indexer

Because of the inherent persistence of VTD-XML, developers can write the internal representation of a parsed XML document to disk and later reload it to avoid repetitive parsing. To this end, XimpleWare has introduced VTD+XML as a binary packaging format combining VTD, LC and the XML text. It can typically be viewed in one of the following two ways: A native XML index that completely eliminates the parsing cost and also retains all benefits of XML. It is a file format that is human readable and backward compatible with XML. A binary XML format that uses binary data to enhance the processing of the XML text.

Other benefits

VTD-XML also pioneers the non-blocking, stateless XPath evaluation approach.

Weaknesses

VTD-XML Also includes noticeable shortcomings/weaknesses: As an XML parser, it does not support external entities declared in the DTD. As a file format, it increases the document size by about 30% to 50%. As an API, it is not compatible with DOM, SAX or StAX. It is difficult to support certain validation techniques, employed by DTD and XML Schema (e.g., default attributes and elements), that require modifications to the XML instances being parsed.

Areas of applications

/* In this java program, we demonstrate how to use XMLModifier to incrementally update a simple XML purchase order. a particular name space. We also are going to use VTDGen's parseFile to simplify programming. / import com.ximpleware.*; public class Update { public static void main(String argv[]) throws NavException, ModifyException, IOException{ // open a file and read the content into a byte array VTDGen vg = new VTDGen(); if (vg.parseFile("oldpo.xml", true)) { VTDNav vn = vg.getNav(); AutoPilot ap = new AutoPilot(vn); XMLModifier xm = new XMLModifier(vn); ap.selectXPath("/purchaseOrder/items/item[@partNum='872-AA']"); int i = -1; while ((i = ap.evalXPath()) != -1) { xm.remove(); xm.insertBeforeElement(" \n"); } ap.selectXPath("/purchaseOrder/items/item/USPrice[.

References

Text derived from https://en.wikipedia.org/w/index.php?oldid=1367018702 under CC BY-SA 4.0; modifications have been made.

Sources cited in this revision

22 named source(s) extracted from the cited revision. A source with no author is shown by its publication; nothing is invented.