14
14
AXClassContext classContext;
15
15
AXElementClass* docClass;
17
inline double walker_process_node(AXElement *cur_node, int siblings) {
23
printf("Node: %i\nSubnodes: ", cur_node->id);
24
for (i=0,node = cur_node->firstChild; node; node = node->nextSibling) {
25
printf("%i ", node->id);
29
switch (cur_node->id) {
31
if (siblings<4) return 0;
42
// printf("Node: %i, size: %i, siblings: %i\n", cur_node->id, size, siblings);
44
for (i=0; i<size; i++) {
46
// int len = cur_node->attributes[i].limit - cur_node->attributes[i].begin;
47
// printf("%p %p %i\n", cur_node->attributes[i].begin, cur_node->attributes[i].limit, len);
48
res += get_value_0(cur_node->attributes[i].begin, cur_node->attributes[i].limit - cur_node->attributes[i].begin);
49
// strncpy(tmp, cur_node->attributes[i].begin, len);tmp[len]=0;
56
double walker(AXElement *node) {
61
for (cur_node = node; cur_node; cur_node = cur_node->nextSibling) {
65
// printf("Node %i Subnodes: %i\n", node->id, i);
67
for (cur_node = node; cur_node; cur_node = cur_node->nextSibling) {
69
res += walker_process_node(cur_node,i);
71
if (cur_node->firstChild) {
72
res += walker(cur_node->firstChild);
79
const char *schema_file = NULL;
17
80
void initXML(struct TestData *td) {
21
84
if (!strcmp(td->fn, "xmlgen")) {
22
85
schema = ReadFile("../xml.files/generated.schema");
24
printf("Schema file is not found\n");
86
} else if (schema_file) {
88
printf("Asmxml needs custom code for each schema, therefore nothing but xmlgen is supported\n");
91
schema = ReadFile(schema_file);
95
printf("Schema file is not found\n");
30
99
ax_initialize((void*)malloc, (void*)free);
141
double res = walker(root);
142
// printf("Sum: %lf\n", res);
71
145
ax_releaseParser(&parseContext);
74
148
int main(int argc, char *argv[]) {
149
if (argc > 3) schema_file = argv[3];
75
151
return Test(argc,argv);