<s>
Virtual	O
Token	O
Descriptor	O
for	O
eXtensible	B-Protocol
Markup	I-Protocol
Language	I-Protocol
(	O
VTD-XML	B-Language
)	O
refers	O
to	O
a	O
collection	O
of	O
cross-platform	O
XML	B-Protocol
processing	O
technologies	O
centered	O
on	O
a	O
non-extractive	O
XML	B-Protocol
,	O
"	O
document-centric	B-Application
"	O
parsing	O
technique	O
called	O
Virtual	O
Token	O
Descriptor	O
(	O
VTD	B-Language
)	O
.	O
</s>
<s>
Depending	O
on	O
the	O
perspective	O
,	O
VTD-XML	B-Language
can	O
be	O
viewed	O
as	O
one	O
of	O
the	O
following	O
:	O
</s>
<s>
VTD-XML	B-Language
is	O
developed	O
by	O
XimpleWare	O
and	O
dual-licensed	O
under	O
GPL	B-License
and	O
proprietary	O
license	O
.	O
</s>
<s>
It	O
is	O
originally	O
written	O
in	O
Java	B-Language
,	O
but	O
is	O
now	O
available	O
in	O
C	B-Language
,	O
C++	B-Language
and	O
C#	B-Application
.	O
</s>
<s>
Traditionally	O
,	O
a	O
lexical	B-Application
analyzer	I-Application
represents	O
tokens	O
(	O
the	O
small	O
units	O
of	O
indivisible	O
character	O
values	O
)	O
as	O
discrete	O
string	O
objects	O
.	O
</s>
<s>
Virtual	O
Token	O
Descriptor	O
(	O
VTD	B-Language
)	O
applies	O
the	O
concept	O
of	O
non-extractive	O
,	O
document-centric	B-Application
parsing	O
to	O
XML	B-Protocol
processing	O
.	O
</s>
<s>
A	O
VTD	B-Language
record	O
uses	O
a	O
64-bit	O
integer	O
to	O
encode	O
the	O
offset	O
,	O
length	O
,	O
token	O
type	O
and	O
nesting	O
depth	O
of	O
a	O
token	O
in	O
an	O
XML	B-Protocol
document	I-Protocol
.	O
</s>
<s>
Because	O
all	O
VTD	B-Language
records	O
are	O
64	O
bits	O
in	O
length	O
,	O
they	O
can	O
be	O
stored	O
efficiently	O
and	O
managed	O
as	O
an	O
array	O
.	O
</s>
<s>
Location	O
Caches	O
(	O
LC	O
)	O
build	O
on	O
VTD	B-Language
records	O
to	O
provide	O
efficient	O
random	O
access	O
.	O
</s>
<s>
Organized	O
as	O
tables	O
,	O
with	O
one	O
table	O
per	O
nesting	O
depth	O
level	O
,	O
LCs	O
contain	O
entries	O
modeling	O
an	O
XML	B-Protocol
document	I-Protocol
's	O
element	O
hierarchy	O
.	O
</s>
<s>
The	O
upper	O
32	O
bits	O
identify	O
the	O
VTD	B-Language
record	O
for	O
the	O
corresponding	O
element	O
.	O
</s>
<s>
Virtually	O
all	O
the	O
core	O
benefits	O
of	O
VTD-XML	B-Language
are	O
inherent	O
to	O
non-extractive	O
,	O
document-centric	B-Application
parsing	O
which	O
provides	O
these	O
characteristics	O
:	O
</s>
<s>
The	O
source	O
XML	B-Protocol
text	O
is	O
kept	O
intact	O
in	O
memory	O
without	O
decoding	O
.	O
</s>
<s>
The	O
internal	O
representation	O
of	O
VTD-XML	B-Language
is	O
inherently	O
persistent	B-Application
.	O
</s>
<s>
Obviates	O
object-oriented	B-Language
modeling	O
of	O
the	O
hierarchical	O
representation	O
as	O
it	O
relies	O
entirely	O
on	O
primitive	O
data	O
types	O
(	O
e.g.	O
,	O
64-bit	O
integers	O
)	O
to	O
represent	O
the	O
XML	B-Protocol
hierarchy	O
,	O
thus	O
reducing	O
object	O
creation	O
cost	O
to	O
nearly	O
zero	O
.	O
</s>
<s>
Combining	O
those	O
characteristics	O
permits	O
thinking	O
of	O
XML	B-Protocol
purely	O
as	O
syntax	O
(	O
bits	O
,	O
bytes	O
,	O
offsets	O
,	O
lengths	O
,	O
fragments	O
,	O
namespace-compensated	O
fragments	O
,	O
and	O
document	O
composition	O
)	O
instead	O
of	O
the	O
serialization/deserialization	O
of	O
objects	O
.	O
</s>
<s>
This	O
is	O
a	O
powerful	O
way	O
to	O
think	O
about	O
XML/SOA	O
applications	O
.	O
</s>
<s>
VTD-XML	B-Language
conforms	O
strictly	O
to	O
XML	B-Protocol
1.0	O
(	O
Except	O
the	O
DTD	O
part	O
)	O
and	O
XML	B-Protocol
Namespace	O
1.0	O
.	O
</s>
<s>
It	O
essentially	O
conforms	O
to	O
XPath	B-Language
1.0	I-Language
spec	O
(	O
with	O
some	O
subtle	O
differences	O
in	O
terms	O
of	O
underlying	O
data	O
model	O
)	O
with	O
extension	O
to	O
XPath	B-Language
2.0	O
built-in	O
functions	O
.	O
</s>
<s>
When	O
used	O
in	O
parsing	O
mode	O
,	O
VTD-XML	B-Language
is	O
a	O
general	O
purpose	O
,	O
extremely	O
high	O
performance	O
XML	B-Protocol
parser	I-Protocol
which	O
compares	O
favorably	O
with	O
others	O
:	O
</s>
<s>
VTD-XML	B-Language
typically	O
outperforms	O
SAX	B-Application
(	O
with	O
NULL	O
content	O
handler	O
)	O
while	O
still	O
providing	O
full	O
random	O
access	O
and	O
built-in	O
XPath	B-Language
support	O
.	O
</s>
<s>
Applications	O
written	O
in	O
VTD-XML	B-Language
are	O
usually	O
much	O
shorter	O
and	O
cleaner	O
than	O
their	O
DOM	B-General_Concept
or	O
SAX	B-Application
versions	O
.	O
</s>
<s>
Because	O
of	O
the	O
inherent	O
persistence	B-Application
of	O
VTD-XML	B-Language
,	O
developers	O
can	O
write	O
the	O
internal	O
representation	O
of	O
a	O
parsed	O
XML	B-Protocol
document	I-Protocol
to	O
disk	O
and	O
later	O
reload	O
it	O
to	O
avoid	O
repetitive	O
parsing	O
.	O
</s>
<s>
To	O
this	O
end	O
,	O
XimpleWare	O
has	O
introduced	O
VTD+XML	O
as	O
a	O
binary	O
packaging	O
format	O
combining	O
VTD	B-Language
,	O
LC	O
and	O
the	O
XML	B-Protocol
text	O
.	O
</s>
<s>
A	O
native	O
XML	B-Protocol
index	O
that	O
completely	O
eliminates	O
the	O
parsing	O
cost	O
and	O
also	O
retains	O
all	O
benefits	O
of	O
XML	B-Protocol
.	O
</s>
<s>
It	O
is	O
a	O
file	B-Protocol
format	I-Protocol
that	O
is	O
human	O
readable	O
and	O
backward	O
compatible	O
with	O
XML	B-Protocol
.	O
</s>
<s>
A	O
binary	B-Protocol
XML	I-Protocol
format	O
that	O
uses	O
binary	O
data	O
to	O
enhance	O
the	O
processing	O
of	O
the	O
XML	B-Protocol
text	O
.	O
</s>
<s>
Because	O
VTD-XML	B-Language
keeps	O
the	O
XML	B-Protocol
text	O
intact	O
without	O
decoding	O
,	O
when	O
an	O
application	O
intends	O
to	O
modify	O
the	O
content	O
of	O
XML	B-Protocol
it	O
only	O
needs	O
to	O
modify	O
the	O
portions	O
most	O
relevant	O
to	O
the	O
changes	O
.	O
</s>
<s>
This	O
is	O
in	O
stark	O
contrast	O
with	O
DOM	B-General_Concept
,	O
SAX	B-Application
,	O
or	O
StAx	B-Language
parsing	O
,	O
which	O
incur	O
the	O
cost	O
of	O
parsing	O
and	O
re-serialization	O
no	O
matter	O
how	O
small	O
the	O
changes	O
are	O
.	O
</s>
<s>
Since	O
VTDs	B-Language
refer	O
to	O
document	O
elements	O
by	O
their	O
offsets	O
,	O
changes	O
to	O
the	O
length	O
of	O
elements	O
occurring	O
earlier	O
in	O
a	O
document	O
require	O
adjustments	O
to	O
VTDs	B-Language
referring	O
to	O
all	O
later	O
elements	O
.	O
</s>
<s>
An	O
application	O
based	O
on	O
VTD-XML	B-Language
can	O
also	O
use	O
offsets	O
and	O
lengths	O
to	O
address	O
tokens	O
,	O
or	O
element	O
fragments	O
.	O
</s>
<s>
This	O
allows	O
XML	B-Protocol
documents	I-Protocol
to	O
be	O
manipulated	O
like	O
arrays	O
of	O
bytes	O
.	O
</s>
<s>
As	O
a	O
slicer	O
,	O
VTD-XML	B-Language
can	O
"	O
slice	O
"	O
off	O
a	O
token	O
or	O
an	O
element	O
fragment	O
from	O
an	O
XML	B-Protocol
document	I-Protocol
,	O
then	O
insert	O
it	O
back	O
into	O
another	O
location	O
in	O
the	O
same	O
document	O
,	O
or	O
into	O
a	O
different	O
document	O
.	O
</s>
<s>
As	O
a	O
splitter	O
,	O
VTD-XML	B-Language
can	O
split	O
sub-elements	O
in	O
an	O
XML	B-Protocol
document	I-Protocol
and	O
dump	O
each	O
into	O
a	O
separate	O
XML	B-Protocol
document	I-Protocol
.	O
</s>
<s>
As	O
an	O
assembler	O
,	O
VTD-XML	B-Language
can	O
"	O
cut	O
"	O
chunks	O
out	O
of	O
multiple	O
XML	B-Protocol
documents	I-Protocol
and	O
assemble	O
them	O
into	O
a	O
new	O
XML	B-Protocol
document	I-Protocol
.	O
</s>
<s>
Used	O
as	O
an	O
editor/eraser	O
,	O
VTD-XML	B-Language
can	O
directly	O
edit/erase	O
the	O
underlying	O
byte	O
content	O
of	O
the	O
XML	B-Protocol
text	O
,	O
provided	O
that	O
the	O
token	O
length	O
is	O
wider	O
than	O
the	O
intended	O
new	O
content	O
.	O
</s>
<s>
An	O
immediate	O
benefit	O
of	O
this	O
approach	O
is	O
that	O
the	O
application	O
can	O
immediately	O
reuse	O
the	O
original	O
VTD	B-Language
and	O
LC	O
.	O
</s>
<s>
In	O
contrast	O
,	O
when	O
using	O
VTD-XML	B-Language
to	O
incrementally	O
update	O
an	O
XML	B-Protocol
document	I-Protocol
,	O
an	O
application	O
needs	O
to	O
reparse	O
the	O
updated	O
document	O
before	O
the	O
application	O
can	O
process	O
it	O
.	O
</s>
<s>
When	O
a	O
complete	O
,	O
contiguous	O
XML	B-Protocol
document	I-Protocol
is	O
needed	O
,	O
such	O
as	O
when	O
saving	O
it	O
,	O
the	O
disparate	O
parts	O
can	O
be	O
reassembled	O
into	O
a	O
new	O
,	O
contiguous	O
document	O
.	O
</s>
<s>
VTD-XML	B-Language
also	O
pioneers	O
the	O
non-blocking	O
,	O
stateless	O
XPath	B-Language
evaluation	O
approach	O
.	O
</s>
<s>
VTD-XML	B-Language
also	O
exhibits	O
a	O
few	O
noticeable	O
shortcomings	O
:	O
</s>
<s>
As	O
an	O
XML	B-Protocol
parser	I-Protocol
,	O
it	O
does	O
not	O
support	O
external	O
entities	O
declared	O
in	O
the	O
DTD	O
.	O
</s>
<s>
As	O
a	O
file	B-Protocol
format	I-Protocol
,	O
it	O
increases	O
the	O
document	O
size	O
by	O
about	O
30%	O
to	O
50%	O
.	O
</s>
<s>
As	O
an	O
API	O
,	O
it	O
is	O
not	O
compatible	O
with	O
DOM	B-General_Concept
,	O
SAX	B-Application
or	O
StAX	B-Language
.	O
</s>
<s>
It	O
is	O
difficult	O
to	O
support	O
certain	O
validation	O
techniques	O
,	O
employed	O
by	O
DTD	O
and	O
XML	B-Protocol
Schema	O
(	O
e.g.	O
,	O
default	O
attributes	O
and	O
elements	O
)	O
,	O
that	O
require	O
modifications	O
to	O
the	O
XML	B-Protocol
instances	O
being	O
parsed	O
.	O
</s>
<s>
Because	O
of	O
VTD-XML	B-Language
'	O
s	O
performance	O
and	O
memory	O
advantages	O
,	O
it	O
covers	O
a	O
larger	O
portion	O
of	O
XML	B-Protocol
use	O
cases	O
than	O
either	O
DOM	B-General_Concept
or	O
SAX	B-Application
.	O
</s>
<s>
Compared	O
to	O
DOM	B-General_Concept
,	O
VTD-XML	B-Language
processes	O
bigger	O
(	O
3x	O
~	O
5x	O
)	O
XML	B-Protocol
documents	I-Protocol
for	O
the	O
same	O
amount	O
of	O
physical	O
memory	O
at	O
about	O
3	O
to	O
10	O
times	O
the	O
performance	O
.	O
</s>
<s>
Compared	O
to	O
SAX	B-Application
,	O
VTD-XML	B-Language
provides	O
random	O
access	O
and	O
XPath	B-Language
support	O
and	O
outperforms	O
SAX	B-Application
by	O
at	O
least	O
2x	O
.	O
</s>
<s>
The	O
extended	O
edition	O
of	O
VTD-XML	B-Language
combining	O
with	O
64-bit	O
JVM	O
makes	O
possible	O
XPath-based	O
XML	B-Protocol
processing	O
over	O
huge	O
XML	B-Protocol
documents	I-Protocol
(	O
up	O
to	O
256	O
GB	O
)	O
in	O
size	O
.	O
</s>
<s>
The	O
combination	O
of	O
VTD-XML	B-Language
'	O
s	O
high	O
performance	O
and	O
incremental-update	O
capability	O
makes	O
it	O
essential	O
to	O
achieve	O
the	O
desired	O
level	O
of	O
quality	O
of	O
service	O
for	O
SOA/WS/XML	O
security	O
applications	O
.	O
</s>
<s>
VTD-XML	B-Language
is	O
well	O
suited	O
for	O
SOA	O
intermediary	O
applications	O
such	O
as	O
XML	B-Protocol
routers/switches/gateways	O
,	O
Enterprise	O
Service	O
Buses	O
,	O
and	O
services	O
aggregation	O
points	O
.	O
</s>
<s>
All	O
those	O
applications	O
perform	O
the	O
basic	O
"	O
store	O
and	O
forward	O
"	O
operations	O
for	O
which	O
retaining	O
the	O
original	O
XML	B-Protocol
is	O
critical	O
for	O
minimizing	O
latency	O
.	O
</s>
<s>
VTD-XML	B-Language
'	O
s	O
incremental	O
update	O
capability	O
also	O
contributes	O
significantly	O
to	O
the	O
forwarding	O
performance	O
.	O
</s>
<s>
VTD-XML	B-Language
'	O
s	O
random-access	O
capability	O
lends	O
itself	O
well	O
to	O
XPath-based	O
XML	B-Protocol
routing/switching/filtering	O
common	O
in	O
AJAX	B-Device
and	O
SOA	O
deployment	O
.	O
</s>
<s>
When	O
an	O
XML	B-Protocol
document	I-Protocol
travels	O
through	O
several	O
middle-tier	O
SOA	O
components	O
,	O
the	O
first	O
message	O
stop	O
,	O
after	O
finishing	O
the	O
inspection	O
of	O
the	O
XML	B-Protocol
document	I-Protocol
,	O
can	O
choose	O
to	O
send	O
the	O
VTD+XML	O
file	B-Protocol
format	I-Protocol
to	O
the	O
downstream	O
components	O
to	O
avoid	O
repetitive	O
parsing	O
,	O
thus	O
improving	O
throughput	O
.	O
</s>
<s>
By	O
the	O
same	O
token	O
,	O
an	O
intelligent	O
SOA	O
load	O
balancer	O
can	O
choose	O
to	O
generate	O
VTD+XML	O
for	O
incoming/outgoing	O
SOAP	O
messages	O
to	O
offload	O
XML	B-Protocol
parsing	O
from	O
the	O
application	O
servers	O
that	O
receive	O
those	O
messages	O
.	O
</s>
<s>
When	O
viewed	O
from	O
the	O
perspective	O
of	O
native	O
XML	B-Protocol
persistence	B-Application
,	O
VTD-XML	B-Language
can	O
be	O
used	O
as	O
a	O
human-readable	O
,	O
easy	O
to	O
use	O
,	O
general-purpose	O
XML	B-Protocol
index	O
.	O
</s>
<s>
XML	B-Protocol
documents	I-Protocol
stored	O
this	O
way	O
can	O
be	O
loaded	O
into	O
memory	O
to	O
be	O
queried	O
,	O
updated	O
,	O
or	O
edited	O
without	O
the	O
overhead	O
of	O
parsing/re	O
-serialization	O
.	O
</s>
<s>
VTD-XML	B-Language
'	O
s	O
combination	O
of	O
high	O
performance	O
,	O
low	O
memory	O
usage	O
,	O
and	O
efficient	O
XPath	B-Language
evaluation	O
makes	O
possible	O
a	O
new	O
XML	B-Language
data	I-Language
binding	I-Language
approach	O
based	O
entirely	O
on	O
XPath	B-Language
.	O
</s>
<s>
This	O
approach	O
's	O
biggest	O
benefit	O
is	O
it	O
no	O
longer	O
requires	O
XML	B-Protocol
schema	O
,	O
avoids	O
needless	O
object	O
creation	O
,	O
and	O
takes	O
advantage	O
of	O
XML	B-Protocol
's	O
inherent	O
loose	O
encoding	O
.	O
</s>
<s>
It	O
is	O
worth	O
noting	O
that	O
data	O
binding	O
discussed	O
in	O
the	O
article	O
mentioned	O
above	O
needs	O
to	O
be	O
implemented	O
by	O
the	O
application	O
:	O
VTD-XML	B-Language
itself	O
only	O
offers	O
accessors	O
.	O
</s>
<s>
In	O
this	O
regard	O
VTD-XML	B-Language
is	O
not	O
a	O
data	O
binding	O
solution	O
itself	O
(	O
unlike	O
JiBX	O
,	O
JAXB	O
,	O
XMLBeans	O
)	O
,	O
although	O
it	O
offers	O
extraction	O
functionality	O
for	O
data	O
binding	O
packages	O
,	O
much	O
like	O
other	O
XML	B-Protocol
parsers	I-Protocol
(	O
DOM	B-General_Concept
,	O
SAX	B-Application
,	O
StAX	B-Language
)	O
.	O
</s>
<s>
As	O
of	O
Version	O
2.11	O
,	O
the	O
Java	B-Language
and	O
C#	B-Application
versions	O
of	O
VTD-XML	B-Language
consist	O
of	O
the	O
following	O
classes	O
:	O
</s>
<s>
VTDGen	O
(	O
VTD	B-Language
Generator	O
)	O
is	O
the	O
class	O
that	O
encapsulates	O
the	O
main	O
parsing	O
,	O
index	O
loading	O
and	O
index	O
writing	O
functions	O
.	O
</s>
<s>
VTDNav	O
(	O
VTD	B-Language
Navigator	O
)	O
is	O
the	O
class	O
that	O
(	O
1	O
)	O
encapsulates	O
XML	B-Protocol
,	O
VTD	B-Language
,	O
and	O
hierarchical	O
info	O
,	O
(	O
2	O
)	O
contains	O
various	O
navigation	O
methods	O
,	O
(	O
3	O
)	O
performs	O
various	O
comparisons	O
between	O
VTD	B-Language
records	O
and	O
strings	O
,	O
and	O
(	O
4	O
)	O
converts	O
VTD	B-Language
records	O
to	O
primitive	O
data	O
types	O
.	O
</s>
<s>
AutoPilot	O
is	O
a	O
class	O
containing	O
functions	O
that	O
perform	O
node-level	O
iteration	O
and	O
XPath	B-Language
.	O
</s>
<s>
The	O
extended	O
VTD-XML	B-Language
consists	O
of	O
the	O
following	O
classes	O
:	O
</s>
<s>
VTDGenHuge	O
(	O
Extended	O
VTD	B-Language
Generator	O
)	O
encapsulates	O
the	O
main	O
parsing	O
.	O
</s>
<s>
XMLBuffer	O
performs	O
in-memory	O
loading	O
of	O
XML	B-Protocol
documents	I-Protocol
.	O
</s>
<s>
XMLMemMappedBuffer	O
performs	O
memory	O
mapped	O
loading	O
of	O
XML	B-Protocol
documents	I-Protocol
.	O
</s>
<s>
VTDNavHuge	O
(	O
Extended	O
VTD	B-Language
Navigator	O
)	O
(	O
1	O
)	O
encapsulates	O
XML	B-Protocol
,	O
Extended	O
VTD	B-Language
,	O
and	O
hierarchical	O
info	O
,	O
(	O
2	O
)	O
contains	O
various	O
navigation	O
methods	O
,	O
(	O
3	O
)	O
performs	O
various	O
comparisons	O
between	O
VTD	B-Language
records	O
and	O
strings	O
,	O
and	O
(	O
4	O
)	O
converts	O
VTD	B-Language
records	O
to	O
primitive	O
data	O
types	O
.	O
</s>
<s>
AutoPilotHuge	O
performs	O
node-level	O
iteration	O
and	O
XPath	B-Language
.	O
</s>
