public class VTDGen
extends java.lang.Object
Constructor and Description |
---|
VTDGen()
VTDGen constructor method.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear internal states so VTDGEn can process the next file.
|
void |
enableIgnoredWhiteSpace(boolean b)
Enable the parser to collect all white spaces, including the trivial white spaces
By default, trivial white spaces are ignored
|
long |
getIndexSize()
Pre-compute the size of VTD+XML index
|
VTDNav |
getNav()
This method returns the VTDNav object after parsing, it also cleans
internal state so VTDGen can process the next file.
|
VTDNav |
loadIndex(byte[] ba)
This method loads the VTD+XML from a byte array
|
VTDNav |
loadIndex(java.io.InputStream is)
This method loads the VTD+XML from an input stream
|
VTDNav |
loadIndex(java.lang.String fileName)
This method loads the VTD+XML from a file
|
VTDNav |
loadSeparateIndex(java.lang.String XMLFileName,
java.lang.String VTDIndexName)
Load the separate VTD index and XmL file.
|
void |
parse(boolean NS)
Generating VTD tokens and Location cache info.
|
boolean |
parseFile(java.lang.String fileName,
boolean ns)
This method parses the XML file and returns a boolean indicating
if it is successful or not.When set to true,
VTDGen conforms to XML namespace 1.0 spec
|
boolean |
parseGZIPFile(java.lang.String GZIPfileName,
boolean ns)
This method inflates then parses GZIP'ed XML file and returns a boolean indicating
if it is successful or not.When set to true,
VTDGen conforms to XML namespace 1.0 spec
|
boolean |
parseHttpUrl(java.lang.String url,
boolean ns)
This method retrieves an XML document from the net using HTTP request
If the returned content type is "application xml" then it will proceed
with the parsing.
|
boolean |
parseZIPFile(java.lang.String ZIPfileName,
java.lang.String XMLName,
boolean ns)
This method inflates then parses ZIP'ed XML file and returns a boolean indicating
if it is successful or not.When set to true,
VTDGen conforms to XML namespace 1.0 spec
|
void |
selectLcDepth(int i)
Configure VTDGen to generate Location Cache of either depth 3 or 5
This method is meant to called before setDoc() or parseFile()
|
void |
setDoc_BR(byte[] ba)
The buffer-reuse version of setDoc
The concept is to reuse LC and VTD buffer for
XML parsing, instead of allocating every time
|
void |
setDoc_BR(byte[] ba,
int os,
int len)
The buffer-reuse version of setDoc
The concept is to reuse LC and VTD buffer for
XML parsing, instead of allocating every time
|
void |
setDoc(byte[] ba)
Set the XMLDoc container.
|
void |
setDoc(byte[] ba,
int os,
int len)
Set the XMLDoc container.
|
void |
writeIndex(java.io.OutputStream os)
This method writes the VTD+XML into an outputStream
|
void |
writeIndex(java.lang.String fileName)
This method writes the VTD+XML file into a file of the given name
|
void |
writeSeparateIndex(java.io.OutputStream os)
This method writes the VTDs and LCs into an outputStream
|
void |
writeSeparateIndex(java.lang.String fileName)
This method writes the VTDs and LCs into a file of the given name
XML is not part of the index
please refer to VTD-XML web site for the spec and explanation
|
public static final int FORMAT_ASCII
public static final int FORMAT_ISO_8859_1
public static final int FORMAT_ISO_8859_10
public static final int FORMAT_ISO_8859_11
public static final int FORMAT_ISO_8859_12
public static final int FORMAT_ISO_8859_13
public static final int FORMAT_ISO_8859_14
public static final int FORMAT_ISO_8859_15
public static final int FORMAT_ISO_8859_16
public static final int FORMAT_ISO_8859_2
public static final int FORMAT_ISO_8859_3
public static final int FORMAT_ISO_8859_4
public static final int FORMAT_ISO_8859_5
public static final int FORMAT_ISO_8859_6
public static final int FORMAT_ISO_8859_7
public static final int FORMAT_ISO_8859_8
public static final int FORMAT_ISO_8859_9
public static final int FORMAT_UTF_16BE
public static final int FORMAT_UTF_16LE
public static final int FORMAT_UTF8
public static final int FORMAT_WIN_1250
public static final int FORMAT_WIN_1251
public static final int FORMAT_WIN_1252
public static final int FORMAT_WIN_1253
public static final int FORMAT_WIN_1254
public static final int FORMAT_WIN_1255
public static final int FORMAT_WIN_1256
public static final int FORMAT_WIN_1257
public static final int FORMAT_WIN_1258
public static final int MAX_DEPTH
public static final int MAX_PREFIX_LENGTH
public static final int MAX_QNAME_LENGTH
public static final int MAX_TOKEN_LENGTH
public static final int TOKEN_ATTR_NAME
public static final int TOKEN_ATTR_NS
public static final int TOKEN_ATTR_VAL
public static final int TOKEN_CDATA_VAL
public static final int TOKEN_CHARACTER_DATA
public static final int TOKEN_COMMENT
public static final int TOKEN_DEC_ATTR_NAME
public static final int TOKEN_DEC_ATTR_VAL
public static final int TOKEN_DOCUMENT
public static final int TOKEN_DTD_VAL
public static final int TOKEN_ENDING_TAG
public static final int TOKEN_PI_NAME
public static final int TOKEN_PI_VAL
public static final int TOKEN_STARTING_TAG
public void clear()
public void enableIgnoredWhiteSpace(boolean b)
b
- public long getIndexSize()
public VTDNav getNav()
public VTDNav loadIndex(byte[] ba) throws java.io.IOException, IndexReadException
ba
- java.io.IOException
IndexReadException
public VTDNav loadIndex(java.io.InputStream is) throws java.io.IOException, IndexReadException
is
- java.io.IOException
IndexReadException
public VTDNav loadIndex(java.lang.String fileName) throws java.io.IOException, IndexReadException
fileName
- java.io.IOException
IndexReadException
public VTDNav loadSeparateIndex(java.lang.String XMLFileName, java.lang.String VTDIndexName) throws java.io.IOException, IndexReadException
XMLFileName
- name of xml fileVTDIndexName
- name of the vtd index filejava.io.IOException
IndexReadException
public void parse(boolean NS) throws EncodingException, EOFException, EntityException, ParseException
NS
- boolean Enable namespace or notParseException
- Super class for any exceptions during parsing.EOFException
- End of file exception.EntityException
- Entity resolution exception.EncodingException
- UTF/native encoding exception.public boolean parseFile(java.lang.String fileName, boolean ns)
fileName
- ns
- namespace aware or notpublic boolean parseGZIPFile(java.lang.String GZIPfileName, boolean ns)
fileName
- ns
- public boolean parseHttpUrl(java.lang.String url, boolean ns)
url
- public boolean parseZIPFile(java.lang.String ZIPfileName, java.lang.String XMLName, boolean ns)
ZIPfileName
- XMLName
- ns
- public void selectLcDepth(int i) throws ParseException
i
- ParseException
public void setDoc_BR(byte[] ba)
ba
- public void setDoc_BR(byte[] ba, int os, int len)
ba
- byte[]os
- int (in byte)len
- int (in byte)public void setDoc(byte[] ba)
ba
- byte[]public void setDoc(byte[] ba, int os, int len)
ba
- byte[]os
- int (in byte)len
- int (in byte)public void writeIndex(java.io.OutputStream os) throws java.io.IOException, IndexWriteException
os
- java.io.IOException
IndexWriteException
public void writeIndex(java.lang.String fileName) throws java.io.IOException, IndexWriteException
fileName
- java.io.IOException
IndexWriteException
public void writeSeparateIndex(java.io.OutputStream os) throws java.io.IOException, IndexWriteException
os
- java.io.IOException
IndexWriteException
public void writeSeparateIndex(java.lang.String fileName) throws java.io.IOException, IndexWriteException
fileName
- java.io.IOException
IndexWriteException