examples.Indexing.indexWriter.c Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vtd-xml Show documentation
Show all versions of vtd-xml Show documentation
XimpleWare's VTD-XML is, far and away, the industry's most advanced and powerful XML processing model for SOA and Cloud Computing
#include
#include
#include
#include
#include
#include
#include
#include "../vtdGen.h"
struct exception_context the_exception_context[1];
int main(){
exception e;
FILE *fw = NULL;
char* filename = "oldpo.xml";
VTDGen *vg = NULL; // This is the VTDGen that parses XML
// allocate a piece of buffer then reads in the document content
// assume "c:\soap2.xml" is the name of the file
fw = fopen("oldpo.vxl","wb");
//stat(filename,&s);
//i = (int) s.st_size;
//wprintf(L"size of the file is %d \n",i);
//xml = (UByte *)malloc(sizeof(UByte) *i);
//i = fread(xml,sizeof(UByte),i,f);
Try{
vg = createVTDGen();
if (parseFile(vg,TRUE,"oldpo.xml")){
writeIndex(vg,fw);
}
freeVTDGen(vg);
fclose(fw);
}
Catch (e) {
if (e.et == parse_exception)
wprintf(L"parse exception e ==> %s \n %s\n", e.msg, e.sub_msg);
// manual garbage collection here
freeVTDGen(vg);
}
return 0;
}