/xmlbench/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/xmlbench/trunk

« back to all changes in this revision

Viewing changes to parse/parabix.cpp

  • Committer: Suren A. Chilingaryan
  • Date: 2009-09-30 21:09:22 UTC
  • Revision ID: csa@dside.dyndns.org-20090930210922-545nwrb5o2ao6psd
QT pull parser and fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
#include "tools.h"
29
29
 
 
30
#define TEMPLATED_SIMD_LIB
 
31
#include "lib/lib_simd.h"
 
32
#include "lib/sse_simd.h"
 
33
#include "src/engine.h"
30
34
 
31
35
/* Internals */
32
36
#include "src/xmlmodel.h"
78
82
 
79
83
template<>
80
84
inline void Parser_Interface<UTF_8>::StartTag_action(unsigned char * item, int lgth) {
 
85
/*    fwrite((char*)item, 1, lgth, stdout);
 
86
    printf(",");*/
81
87
    return;
82
88
}
83
89
 
160
166
 
161
167
void parseXML(struct TestData *td, unsigned long iter) {
162
168
/*
163
 
    int i = 0;
164
169
    Entity_Info * e;
165
170
    Model_Info * m;
166
 
    while ((td->xml[i] == ' ')||(td->xml[i] == '\r')||(td->xml[i] == '\n')||(td->xml[i] == '\t')) i++;
167
 
    if ((td->xml[i]=='<')&&(td->xml[i+1]=='?')) {
168
 
        for (i+=2;((td->xml[i]!='?')||(td->xml[i+1]!='>'))&&(td->xml[i]);i++);
169
 
        for (i+=2;(td->xml[i] == ' ')||(td->xml[i] == '\r')||(td->xml[i] == '\n')||(td->xml[i] == '\t');i++);
170
 
        if ((td->xml[i]=='<')&&(td->xml[i+1]=='?')) {
171
 
            for (i+=2;((td->xml[i]!='?')||(td->xml[i+1]!='>'))&&(td->xml[i]);i++);
172
 
            for (i+=2;(td->xml[i] == ' ')||(td->xml[i] == '\r')||(td->xml[i] == '\n')||(td->xml[i] == '\t');i++);
173
 
        }
174
 
    }
 
171
    Byteplex * b;
 
172
 
175
173
    e = new Entity_Info;
176
174
    m = new Model_Info;
177
 
    e->AnalyzeSignature((unsigned char*)"<?xml");
 
175
    e->AnalyzeSignature((unsigned char*)"<?xm");
 
176
    b = Byteplex::ByteplexFactory(e, (unsigned char*)td->xml, td->xmllen);
 
177
//    printf("%u %u\n", td->xmllen, strlen(td->xml));
 
178
//    puts(td->xml);
 
179
    b->DoByteplex();
 
180
    b->PreparePseudoASCII_Stream();
 
181
    XML_Decl_Parser<ASCII> decl_parser(b);
 
182
    decl_parser.ReadXMLInfo(*e);
 
183
 
 
184
    Crashes due to the limited buffer size in byteplex.h and some other reasons
178
185
*/    
179
186
 
180
187
    parser = Parser_Interface<UTF_8>::ParserFactory("/tmp/parabix.test");//td->xml+i, td->xmllen-i, e, m);
 
188
//    parser = new ParsingEngine<X8_Buffer<ASCII>, UTF_8>(e, m, b, false);
 
189
//    parser = new ParsingEngine<UTF8_Buffer, UTF_8>(e, m, b, false);
181
190
    parser->Parse_Prolog();
182
191
    parser->Parse_DocumentContent();
183
 
//    parser->~Parser_Interface();
184
192
    delete parser;
185
 
/*
186
 
    delete m;
187
 
    delete e;
188
 
*/
189
193
}
190
194
 
191
195
int main(int argc, char *argv[]) {