-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathschemaParser.cpp
2175 lines (1861 loc) · 84 KB
/
schemaParser.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*
// Program Name : schemaParser.cpp
//
//
// Project : OCR
// Author : Gaurav Harit (PhD EE-2001)
// Creation Date : April 10 -2007. Rights Reserved
// This is a cleaner version of an original program
//~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*
#include "xmlParser.h"
XSDElementDefinition::~XSDElementDefinition() {}
XSDElementDefinition::XSDElementDefinition() {
name = NULL; xTypeName = NULL; xType = NULL; isReference = false;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
XSDAttributeDefinition::~XSDAttributeDefinition() {}
XSDAttributeDefinition::XSDAttributeDefinition() {
name = NULL; isReference = false; fixed = NULL; xType = NULL;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
void
XSDAttributeDefinition::print(char *indent) {
char *myIndent = new char[100];
if (indent != NULL) strcpy (myIndent, indent);
else strcpy (myIndent, "\t\t");
cout << "\n" << myIndent << " XSD-AttributeDefinition: "; if (name != NULL) cout << " [" << name << "]";
if (fixed != NULL) {
cout << " fixed (" << fixed << ")";
}
if (isReference) cout << " is REFER ";
if (xType != NULL) {
cout << " with *xType* ";
strcat (myIndent, "\t");
xType->print(myIndent);
}
delete [] myIndent;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
XSDType::~XSDType() {}
XSDType::XSDType() {
name = NULL; extensionOf = NULL; xRestriction = NULL; nst = NULL; isReference = false;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
XSDRestriction::~XSDRestriction() {}
XSDRestriction::XSDRestriction() {
base = NULL; howSpecified = -1; minInclusive = 0.0; maxInclusive = 0.0;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
void
XSDRestriction::print(char *indent) {
char *myIndent = new char[100];
if (indent != NULL) strcpy (myIndent, indent);
else strcpy (myIndent, "\t\t");
if (base != NULL) cout << "\n" << myIndent << " XSD-Restriction........ base: ["
<< base << "] howSpecified: " << howSpecified;
if (howSpecified == 0) {
cout << "\n" << myIndent << " Specified as enumeration-" << enumeration.size() << ": "; cout << "[";
for (int i=0,Z=enumeration.size(); i<Z; ++i) {
cout << enumeration[i]; if (i != Z-1) cout << ", ";
} cout << "]";
}
if (howSpecified == 1) {
cout << "\n" << myIndent << " Specified as min/max values ";
cout << " " << (float) minInclusive << " -- " << (float)maxInclusive;
}
if (howSpecified == 2) {
cout << "\n" << myIndent << " Specified as min/max values ";
cout << " " << (int) minInclusive << " -- " << (int)maxInclusive;
}
if (howSpecified == 3) {
cout << "\n" << myIndent << " Specified as min/max values +ve ";
cout << " " << (int) minInclusive << " -- " << (int)maxInclusive;
}
delete [] myIndent;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
void
XSDLeaf::print(char *indent) {
char *myIndent = new char[100];
if (indent == NULL) strcpy (myIndent, "\t\t");
else strcpy (myIndent, indent);
cout << "\n" << myIndent << " XSD-Leaf: ";
strcat (myIndent, " ");
if (xElem != NULL) {
cout << "\n" << myIndent << " xsd-Elem-Defn [" << xElem->name << "] "; xElem->print(myIndent);
}
if (xElemGrp != NULL) {
cout << "\n" << myIndent << " xsd-ElemGroup-Defn ";
if (xElemGrp != NULL) cout<<"[" << xElemGrp->name << "] ";
xElemGrp->print(myIndent);
}
if (xAttr != NULL) {
cout << "\n" << myIndent << " xsd-Attribute-Defn "; xAttr->print(myIndent);
}
if (xAttrGrp != NULL) {
cout << "\n" << myIndent << " xsd-Attribute-Group "; xAttrGrp->print(myIndent);
}
if (xType != NULL) {
cout << "\n" << myIndent << " xsd TYPE "; xType->print(myIndent);
}
if (oElem != NULL) {
cout << "\n" << myIndent << " O-Elem ";
oElem->printAttributes ();
}
delete [] myIndent;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
XSDElementGroup::~XSDElementGroup() {}
XSDElementGroup::XSDElementGroup() {
name = NULL; isReference = false;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
void
XSDElementGroup::print(char *indent) {
char *myIndent = new char[100];
if (indent == NULL) strcpy (myIndent, "\t\t");
else strcpy (myIndent, indent);
cout << "\n" << myIndent << " Element Group ["; if (name != NULL) cout << name; cout << "]";
cout << "\n" << myIndent << " Has (" << grpElementsV.size() << ") elements "; cout << "[";
for (int k=0; k<grpElementsV.size(); ++k) {
cout << grpElementsV[k]->name; if (k != grpElementsV.size()-1) cout << ",";
} cout << "] ";
if (isReference) {
cout << " >reference< ";
}
strcat (myIndent, " ");
strcat (myIndent, name);
strcat (myIndent, ":");
for (int k=0; k<grpElementsV.size(); ++k) {
grpElementsV[k]->print(myIndent);
}
delete [] myIndent;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
bool
XSDElementGroup::isGroupMember (char *gElemName) {
for (int k=0; k<grpElementsV.size(); ++k) {
if ( !strcmp (grpElementsV[k]->name, gElemName) ) {
return true;
}
}
return false;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
XSDElementDefinition*
XSDElementGroup::getGroupMember (char *gElemName) {
for (int k=0; k<grpElementsV.size(); ++k) {
if ( !strcmp (grpElementsV[k]->name, gElemName) ) {
return grpElementsV[k];
}
}
return NULL;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
XSDAttributeGroup::~XSDAttributeGroup() {}
XSDAttributeGroup::XSDAttributeGroup() {
name = NULL; isReference = false;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
void
XSDAttributeGroup::print(char *indent) {
char *myIndent = new char[100];
if (indent == NULL) strcpy (myIndent, "\t\t");
else strcpy (myIndent, indent);
cout << "\n" << myIndent << " Attribute Group ["; if (name != NULL) cout << name; cout << "]";
cout << "\n" << myIndent << " Has (" << grpAttributesV.size() << ") elements "; cout << "[";
for (int k=0; k<grpAttributesV.size(); ++k) {
cout << grpAttributesV[k]->name; if (k != grpAttributesV.size()-1) cout << ", ";
} cout << "] ";
if (isReference) {
cout << " >reference< ";
}
strcat (myIndent, " ");
strcat (myIndent, name);
strcat (myIndent, ":");
for (int k=0; k<grpAttributesV.size(); ++k) {
grpAttributesV[k]->print(myIndent);
}
delete [] myIndent;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
bool
XSDAttributeGroup::isGroupMember (char *gAttrName) {
for (int k=0; k<grpAttributesV.size(); ++k) {
if ( !strcmp (grpAttributesV[k]->name, gAttrName) ) {
return true;
}
}
return false;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
XSDAttributeDefinition*
XSDAttributeGroup::getGroupMember (char *gAttrName) {
for (int k=0; k<grpAttributesV.size(); ++k) {
if ( !strcmp (grpAttributesV[k]->name, gAttrName) ) {
return grpAttributesV[k];
}
}
return NULL;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
XSDNestedStructure::~XSDNestedStructure() {}
XSDNestedStructure::XSDNestedStructure() {
isUnion = false; isSequence = false; isAnyOrder = false;
//xLeaf = NULL; xDecomposition = NULL;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
void
XSDNestedStructure::print(char *indent) {
char *myIndent = new char[100];
if (indent == NULL) strcpy (myIndent, "\t\t");
else strcpy (myIndent, indent);
cout << "\n" << myIndent << " Number of Leaves: " << xLeafV.size();
if (isUnion) cout << " Union ";
if (isSequence) cout << " isSequence ";
if (isAnyOrder) cout << " isAnyOrder ";
if (cardinalityStatus.size() > 0) {
cout << "\n" << myIndent << " " << "Cardinality Status ";
for (int k=0; k<cardinalityStatus.size(); ++k) {
cout << "\n" << myIndent << "\t" << cardinalityStatus[k] << " " << min[k] << " " << max[k];
}
}
if (xLeafV.size() > 0) {
cout << "\n" << myIndent << " " << "Printing the Leaves " << xLeafV.size();
strcat (myIndent, " ");
for (int k=0; k<xLeafV.size(); ++k) {
cout << "\n" << myIndent << "Leaf (" << k << ") ";
xLeafV[k]->print(myIndent);
}
}
delete [] myIndent;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
XSDLeaf::~XSDLeaf() {}
XSDLeaf::XSDLeaf() {
xElem = NULL; xElemGrp = NULL; xAttr = NULL; xAttrGrp = NULL; oElem = NULL; xType = NULL;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
//XSDDecomposition::~XSDDecomposition() {}
//XSDDecomposition::XSDDecomposition() {
//}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
XSDAllowedElement::XSDAllowedElement() {
name = NULL; myID = 1;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
XSDAllowedElement::~XSDAllowedElement() {
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
void
XSDAllowedElement::print(char *indent) {
char *myIndent = new char[100];
if (indent != NULL) strcpy (myIndent, indent);
else strcpy (myIndent, "\t\t");
char *buf = new char[100];
sprintf (buf, " xsdAllowedElement: [%2d] { %s }", myID, name); cout <<"\n" << buf;
int F=strlen(buf);
if (allowedChildsN.size() > 0) {
cout << "\n";
for (int i=0; i<F+1; ++i) cout << " ";
cout << allowedChildsN.size() << "-Allowed children: {";
for (int i=0; i<allowedChilds.size(); ++i) {
cout << " " << allowedChilds[i]->name;
if (i != allowedChildsN.size()-1) {
cout << "\n";
for (int i=0; i<F+22; ++i) cout << " ";
}
}
cout << "}";
}
if (allowedAttrs.size() > 0) {
cout << "\n";
for (int i=0; i<F+1; ++i) cout << " ";
cout << allowedAttrs.size() << "-Allowed attributes: {";
for (int i=0; i<allowedAttrs.size(); ++i) {
cout << " " << allowedAttrs[i];
if (i != allowedAttrs.size()-1) {
cout << "\n";
for (int i=0; i<F+24; ++i) cout << " ";
}
}
cout << "}";
}
delete [] buf;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
void
XSDAllowedElement::setName(char *n) {
if (n==NULL) return; if (name != NULL) delete [] name;
name = new char[strlen(n)+1]; strcpy (name, n);
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
void
XSDAllowedElement::addChildName(char *n) {
if (n==NULL) return;
allowedChildsN.push_back(new char[strlen(n)+1]);
strcpy (allowedChildsN.back(), n);
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
void
XSDAllowedElement::addAttributeName(char *n) {
if (n==NULL) return;
allowedAttrs.push_back(new char[strlen(n)+1]);
strcpy (allowedAttrs.back(), n);
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
void
XSDAllowedElement::checkSchemaElementStructure (XMLelement *sElement, XSDparser *spc, int debug) {
if(debug>6) {
cout << "\n\n Check-Schema-Element-Structure() "; sElement->printAttributes();
this->print(); }
int found;
vector<int> matchedArray;
// The child of sElement should be one of the allowable childs of this schema construct
for (int c=0; c<sElement->childs.size(); ++c) {
found = -1;
for (int m=0; m<allowedChilds.size(); ++m) {
if (allowedChilds[m]->matchesElemName (sElement->childs[c]->name)) {
found = m; break;
}
}
if (found == -1) {
cout << "\n ????????????????????????? Strange child element [" << sElement->childs[c]->name<<"]";
sElement->print();
cout << "\n\n"; exit (0);
} else {
matchedArray.push_back (found);
}
}//-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
// Also verify its attributes:
for (int a=0; a<sElement->attributes.size(); ++a) {
found = -1;
for (int m=0; m<allowedAttrs.size(); ++m) {
if (!strcmp (sElement->attributes[a]->name, allowedAttrs[m])) {
found = m; break;
}
}
if (found == -1) {
cout << "\n ????????????????????????? Strange attribute ["
<< sElement->attributes[a]->name<<"]";
sElement->print();
cout << "\n\n"; exit (0);
} else {
// Some day.. we'll write code to validate the value of the attribute also,
// as per any of the schema restrictions.
}
}
// Now recursively call this function for each of the found child elements
for (int c=0; c<sElement->childs.size(); ++c) {
allowedChilds[matchedArray[c]]->checkSchemaElementStructure (sElement->childs[c], spc);
}
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
bool
XSDElementDefinition::checkOtherPossibleAttributes (char *attrName) {
if (!strcmp (attrName, "xmlns:xsi"))
return true;
else if (!strcmp (attrName, "xsi:noNamespaceSchemaLocation"))
return true;
else if (!strcmp (attrName, "xmlns"))
return true;
return false;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
bool
XSDAllowedElement::matchesElemName (char *eName) {
// Break the eName into its name space and actual Name; Then match the two in its own lists.
// cout << "\n Matches-Elem-Name() => Given Name: " << eName;
char *nspace = new char[strlen(eName)+1];
char *onlyName = new char[strlen(eName)+1];
bool gotNS = false;
int k = 0;
for (int i=0,Z=strlen(eName); i<Z; ++i) {
if (eName[i]==':') {
onlyName[k] = '\0';
strcpy (nspace, onlyName); k = 0;
gotNS = true; continue;
}
onlyName[k++] = eName[i];
}
onlyName[k] = '\0';
if (gotNS) {
//cout << "\n Matches-Elem-Name() => Name space: " << nspace;
}
//cout << "\n Matches-Elem-Name() => Element name: " << onlyName;
bool matchedOnlyName = false, alsoMatchedNamespace = false;
if (!strcmp(onlyName, this->name)) {
matchedOnlyName = true;
// Also check if the name space matches the allowable....
for (int k=0; k<allowedNameSpaces.size(); ++k) {
if (!strcmp (allowedNameSpaces[k], nspace)) {
alsoMatchedNamespace = true; break;
}
}
if (allowedNameSpaces.size() == 0) {
alsoMatchedNamespace = true;
}
}//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
delete [] nspace; delete [] onlyName;
if (matchedOnlyName && alsoMatchedNamespace) return true;
else return false;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
bool
XSDparser::matchesElementNameOnly (char *eName, char *eNameWithoutNamespace) {
char *nspace = new char[strlen(eName)+1];
char *onlyName = new char[strlen(eName)+1];
bool gotNS = false;
int k = 0;
for (int i=0,Z=strlen(eName); i<Z; ++i) {
if (eName[i]==':') {
onlyName[k] = '\0';
strcpy (nspace, onlyName); k = 0;
gotNS = true; continue;
}
onlyName[k++] = eName[i];
}
onlyName[k] = '\0';
//cout << "\n Attempting to match: " << onlyName << "-----" << eNameWithoutNamespace;
if (!strcmp(onlyName, eNameWithoutNamespace)) {
delete [] nspace; delete [] onlyName;
return true;
}
delete [] nspace; delete [] onlyName;
return false;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
void
XSDparser::removeNameSpaceQualifier (char *eName) {
for (int i=0,Z=strlen(eName); i<Z; ++i) {
if (eName[i]==':') {
// Shift the entire string from this point onwards
Z = Z-i;
for (int k=0; k<Z; ++k) {
eName[k] = eName[++i];
}
break;
}
}
//cout << "\n After name space removal: " << eName; getchar();
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
SchemaDynamicStructures::SchemaDynamicStructures() {
eleM = NULL;
xsdElem = NULL;
attr = NULL;
xsdAttr = NULL;
xType = NULL;
fileNameInWhichErrorOccurred = NULL;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
void
SchemaDynamicStructures::reset() {
xsdElem = NULL;
eleM = NULL;
attr = NULL;
xsdAttr = NULL;
xType = NULL;
xLeaf = NULL;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_
void
XSDparser::print() {
cout << "\n\n -------------------------- Printing the XSD parser information --------------------";
cout << "\n\t\t With [" << xsdElementDefsV.size() << "] element definitions ";
cout << "\n\t\t With [" << xsdAttributeDefsV.size() << "] attribute definitions ";
cout << "\n\t\t With [" << xsdElementGroupsV.size() << "] element group definitions ";
cout << "\n\t\t With [" << xsdAttributeGroupsV.size() << "] attribute group definitions ";
cout << "\n\t\t With [" << xsdTypesV.size() << "] type definitions ";
cout << "\n\t\t With [" << xsdSimpleDataTypesV.size() << "] simple data types ";
cout << "\n\t\t With [" << xsdAllowedElementsV.size() << "] allowed elements ";
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
//~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*
// Notes:
//~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*~^~*
void
XSDparser::extractSchemaDictatedInformation (vector<XMLelement*> & schemaElementList, XMLparser *xmlParser) {
if(debug>2)
cout << "\n\n ------------------------- Extract Schema Element Information () -------------------- ";
stack<XMLelement*> elmStack;
XMLelement *eleM;
vector<XMLelement*> xxSchemaElementsV;
vector<char*> requiredAttrValues;
for (int i=0; i<schemaElementList.size(); ++i) {
xmlParser->searchElement ("schema", schemaElementList[i],
requiredAttrValues, xxSchemaElementsV, true);
} //-- -- -- -- -- -- -- -- -- -- -- -- -- -- --
if(debug>2)
cout << "\n\n---------------------------------------------------------------------- All xx:schema elements obtained from the schema ";
for (int i=0; i<xxSchemaElementsV.size(); ++i) {
if(debug>5)
xxSchemaElementsV[i]->print();
xxSchemaElementsV[i]->myID = i;
} //-- -- -- -- -- -- -- -- -- -- -- -- -- -- --
// ----------------- Now collect all the information that you can collect from the schema ---------------
XMLelement *schelToAnalyze;
for (int xx=0; xx < xxSchemaElementsV.size(); ++xx) {
for (int cc=0; cc<xxSchemaElementsV[xx]->childs.size(); ++cc) {
schelToAnalyze = xxSchemaElementsV[xx]->childs[cc];
if(debug>2) {
cout << "\n\n --------------------------- started processing it.."; schelToAnalyze->printAttributes();}
if (matchesElementNameOnly (schelToAnalyze->name, "element")) {
if(debug>5)
cout << "\n extractSchemaDictatedInformation() => Got an element to process: ";
XSDElementDefinition *xsdElemDef = attemptToMakeXSDElementDefn (schelToAnalyze);
if (xsdElemDef == NULL) {
// We need to save this element as oElem.
} else {
if(debug>5)
xsdElemDef->print("\t");
this->xsdElementDefsV.push_back(xsdElemDef);
}
} else
if (matchesElementNameOnly (schelToAnalyze->name, "attribute")) {
if(debug>5)
cout << "\n extractSchemaDictatedInformation() => Got an attribute to process: ";
XSDAttributeDefinition *xsdAttrDef = attemptToMakeXSDAttributeDefn (schelToAnalyze);
if(debug>5)
xsdAttrDef->print("\t");
this->xsdAttributeDefsV.push_back (xsdAttrDef);
} else
if (matchesElementNameOnly (schelToAnalyze->name, "complexType")) {
if(debug>5)
cout << "\n extractSchemaDictatedInformation() => Got a complexType to process: ";
XSDType *xType = attemptToMakeXSDType (schelToAnalyze);
if(debug>5)
xType->print("\t");
this->xsdTypesV.push_back (xType);
} else
if (matchesElementNameOnly (schelToAnalyze->name, "simpleType")) {
if(debug>5)
cout << "\n extractSchemaDictatedInformation() => Got a simpleType to process: ";
XSDType *xType = attemptToMakeXSDType (schelToAnalyze);
if(debug>5)
xType->print("\t");
this->xsdTypesV.push_back (xType);
} else
if (matchesElementNameOnly (schelToAnalyze->name, "elementGroup")) {
if(debug>5)
cout << "\n extractSchemaDictatedInformation() => Got a elementGroup to process: ";
XSDElementGroup *xElemGrp = attemptToMakeXSDElementGroup (schelToAnalyze);
if(debug>5)
xElemGrp->print("\t");
this->xsdElementGroupsV.push_back (xElemGrp);
} else
if (matchesElementNameOnly (schelToAnalyze->name, "attributeGroup")) {
if(debug>5)
cout << "\n extractSchemaDictatedInformation() => Got a attributeGroup to process: ";
XSDAttributeGroup *xAttrGrp = attemptToMakeXSDAttributeGroup (schelToAnalyze);
if(debug>5)
xAttrGrp->print("\t");
this->xsdAttributeGroupsV.push_back (xAttrGrp);
}
}
}
// -------------- We have finished one round of parsing for the schema.
// -------------- The left over work concerned with forward referencing needs to be done now.
for (int k=0; k<sdd->incompleteWorksV.size(); ++k) {
if (!strcmp (sdd->incompleteWorksV[k]->workName, "extension")) {
//cout << "\n Doing processing in the second pass: "; sdd->incompleteWorksV[k]->print();
XMLelement *celem = sdd->incompleteWorksV[k]->xelem;
XSDType *xType = sdd->incompleteWorksV[k]->xType;
char *typeName = celem->getAttributeValue("base");
if (typeName != NULL) { // Extension of this type...
XSDType *toExtendType = getXSDType (typeName);
if (toExtendType != NULL) {
xType->extensionOf = toExtendType;
extendXSDType (xType, toExtendType);
fillUpDetailsForXSDType (xType, celem);//Carry on
} else {
XSDElementDefinition *toExtendElem =
getXSDElementDefinition (typeName);
if (toExtendElem != NULL) {
xType->extensionOf = toExtendElem->xType;
extendXSDType (xType, toExtendElem->xType);
fillUpDetailsForXSDType (xType, celem);
//cout << "\n --------------------------------------";
//xType->print();
//cout << "\n --------------------------------------"<<flush;
} else {
sdd->eleM = celem;
this->setString ( sdd->fileNameInWhichErrorOccurred,
this->schemaFileName);
sprintf (buf, " fillUpDetailsFor-XSD-Type-Defn() => The base [%s] of extension has not been defined ",
typeName);
popError (10, buf);
assert (1==2);
}
}
}
}
}
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
XSDElementDefinition*
XSDparser::attemptToMakeXSDElementDefn (XMLelement *elem) {
// Cases to handle:
// Case 1: If there is an attribute ref, then return NULL
// Case 2: If there is an attribute name, then instantiate XSDElementDefinition
// Now comes the problem of handling the type.
// That can be specified directly, or to be constructed.
char *value;
XSDElementDefinition *xsdElemDef;
sdd->reset();
xsdElemDef = new XSDElementDefinition();
value = elem->getAttributeValue("ref");
if (value != NULL) { // This is a reference to the element.
xsdElemDef->setString(xsdElemDef->name, value);
xsdElemDef->isReference = true;
assert (elem->childs.size() == 0);
return xsdElemDef;
}
value = elem->getAttributeValue("name");
if (value != NULL) {
xsdElemDef->setString(xsdElemDef->name, value);
}
value = elem->getAttributeValue("type");
if (value != NULL) {
xsdElemDef->setString(xsdElemDef->xTypeName, value);
xsdElemDef->xType = new XSDType();
setString(xsdElemDef->xType->name, value); // May be simple type or a reference.
xsdElemDef->xType->isReference = true; // If not found in reference list, then it is a simple type.
}
// Check for a child element. If there is a child element complexType, then expect the XSDType object
// to be returned. If the child element says simpleType.. even then expect XSDType object to be returned.
for (int c=0; c<elem->childs.size(); ++c) {
if (matchesElementNameOnly (elem->childs[c]->name, "complexType") ||
matchesElementNameOnly (elem->childs[c]->name, "simpleType")
) {
if (xsdElemDef->xType != NULL) {
sdd->eleM = elem;
sdd->xsdElem = xsdElemDef;
popError (10, " Multiple specification of TYPE of the element.... Check Schema ");
}
if(debug>5)
cout << "\n\t\t\t attemptToMake-XSD-Element-Defn() => Got a complex/simple:: Type.. ";
xsdElemDef->xType = attemptToMakeXSDType (elem->childs[c]);
} else {
if(debug>5)
elem->childs[c]->print();
sdd->eleM = elem->childs[c];
this->setString (sdd->fileNameInWhichErrorOccurred, this->schemaFileName);
popError (10, " attemptToMake-XSD-Element-Defn() => Child element NOT HANDLED ");
assert (1==2); // No other child element is allowed.
}
}
return xsdElemDef;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
void
XSDElementDefinition::setString(char *& tString, char *gString) {
if (tString != NULL) delete [] tString;
tString = new char[strlen(gString)+1];
strcpy (tString, gString);
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
void
XSDElementDefinition::print(char *indent) {
char *myIndent = new char[100];
if (indent != NULL) {
strcpy (myIndent, indent);
} else strcpy (myIndent, "\t\t");
cout << "\n" << myIndent << " XSDElementDefinition: ";
if (name != NULL) cout << " [" << name << "]";
if (xTypeName != NULL) cout << " type: " << xTypeName;
if (isReference) cout << " >reference< ";
strcat (myIndent, " ");
if (xType != NULL) xType->print(myIndent);
delete [] myIndent;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
void
XSDType::setString(char *& tString, char *gString) {
if (tString != NULL) delete [] tString;
tString = new char[strlen(gString)+1];
strcpy (tString, gString);
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
void
XSDparser::setString(char *& tString, char *gString) {
if (tString != NULL) delete [] tString;
tString = new char[strlen(gString)+1];
strcpy (tString, gString);
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
void
XSDType::print(char *indent) {
char *myIndent = new char[100];
if (indent != NULL) {
strcpy (myIndent, indent);
} else strcpy (myIndent, "\t\t");
cout << "\n" << myIndent << " XSDType: ";
if (name != NULL) cout << " [" << name << "]";
if (isReference) cout << " reference/in-built ";
strcat (myIndent, " ");
if (extensionOf != NULL) {
char *buf = new char[200]; strcpy (buf, myIndent); strcat (buf, "Extension");
extensionOf->print(buf);
delete [] buf;
}
if (xRestriction != NULL) xRestriction->print(myIndent);
if (nst != NULL) nst->print(myIndent);
if (attributesV.size() > 0) {
cout << "\n" << myIndent << " Has attributes " << attributesV.size();
for (int i=0; i<attributesV.size(); ++i)
attributesV[i]->print(myIndent);
}
if (attrGroupsV.size() > 0) {
cout << "\n" << myIndent << " Has attribute-Groups " << attrGroupsV.size();
for (int i=0; i<attrGroupsV.size(); ++i)
attrGroupsV[i]->print(myIndent);
}
delete [] myIndent;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
XSDAttributeDefinition*
XSDparser::attemptToMakeXSDAttributeDefn (XMLelement *elem) {
char *value;
// value = elem->getAttributeValue("ref");
// if (value != NULL) { // This is a reference to the element.
// return NULL;
// }
XSDAttributeDefinition *xsdAttr;
sdd->reset();
xsdAttr = new XSDAttributeDefinition();
value = elem->getAttributeValue("name");
if (value != NULL) {
setString(xsdAttr->name, value);
}
value = elem->getAttributeValue("ref");
if (value != NULL) {
setString(xsdAttr->name, value);
xsdAttr->isReference = true;
}
value = elem->getAttributeValue("fixed");
if (value != NULL) {
setString(xsdAttr->fixed, value);
}
value = elem->getAttributeValue("type");
if (value != NULL) {
if (xsdAttr->xType != NULL) {
sdd->eleM = elem; sdd->xsdAttr = xsdAttr;
popError (10, " The element has an already assigned TYPE ??? ");
}
xsdAttr->xType = new XSDType;
setString (xsdAttr->xType->name, value);
xsdAttr->xType->isReference = true; // Simple data-type OR Defined-type.
}
for (int c=0; c<elem->childs.size(); ++c) {
if (matchesElementNameOnly (elem->childs[c]->name, "simpleType") ||
matchesElementNameOnly (elem->childs[c]->name, "complexType")
) {
if(debug>5)
cout << "\n\t\t\t attemptToMake-XSD-Attribute-Defn() => Got an XSD-TYPED-attribute.. ";
XSDType *xsdType = attemptToMakeXSDType (elem->childs[c]);
if (xsdAttr->xType != NULL) {
sdd->eleM = elem; sdd->xsdAttr = xsdAttr;
popError (10, " The element has an already assigned TYPE ??? ");
}
if (xsdType != NULL) xsdAttr->xType = xsdType; // Do not overwrite previous one?
} else {
sdd->eleM = elem;
this->setString (sdd->fileNameInWhichErrorOccurred, this->schemaFileName);
sprintf (buf, " attemptToMake-XSD-Attribute-Defn() => Child [%s] NOT HANDLED ",elem->childs[c]->name);
popError (10, buf);
assert (1==2); // No other child element is allowed.
}
}
return xsdAttr;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
XSDType*
XSDparser::attemptToMakeXSDType (XMLelement *elem) {
// Check if the type has got any name:
XSDType *xType;
xType = new XSDType();
char *value;
sdd->reset();
value = elem->getAttributeValue("ref");
if (value != NULL) { // This is a reference to the element.
xType->setString(xType->name, value);
xType->isReference = true;
assert (elem->childs.size() == 0);
return xType;
}
value = elem->getAttributeValue("name");
if (value != NULL) {
xType->setString(xType->name, value);
}
this->fillUpDetailsForXSDType (xType, elem);
return xType;
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
void
XSDparser::fillUpDetailsForXSDType (XSDType *xType, XMLelement *elem) {
// Check for a child element.
for (int c=0; c<elem->childs.size(); ++c) {
if (matchesElementNameOnly (elem->childs[c]->name, "sequence") ) {
if(debug>5)
cout << "\n\t\t\t attemptToMake-XSD-Type-Defn() => Got a Sequence.. ";
XSDNestedStructure *gotNstStructure = attemptToMakeXSDNestedSt (elem->childs[c]);
if (xType->nst == NULL) xType->nst = gotNstStructure;
else xType->nst->addToNestedStructure (gotNstStructure);
} else
if (matchesElementNameOnly (elem->childs[c]->name, "union") ) {
if(debug>5)
cout << "\n\t\t\t attemptToMake-XSD-Type-Defn() => Got a Union.. ";
//xType->nst = attemptToMakeXSDNestedSt (elem->childs[c]);
XSDNestedStructure *gotNstStructure = attemptToMakeXSDNestedSt (elem->childs[c]);
if (xType->nst == NULL) xType->nst = gotNstStructure;
else xType->nst->addToNestedStructure (gotNstStructure);
} else
if (matchesElementNameOnly (elem->childs[c]->name, "restriction") ) {
if(debug>5)
cout << "\n\t\t\t attemptToMake-XSD-Type-Defn() => Got a Restriction.. ";
xType->xRestriction = attemptToMakeXSDRestriction (elem->childs[c]);
} else
if (matchesElementNameOnly (elem->childs[c]->name, "attribute") ) {
if(debug>5)
cout << "\n\t\t\t attemptToMake-XSD-Type-Defn() => Got an attribute.. ";
XSDAttributeDefinition *xsdAttr = attemptToMakeXSDAttributeDefn (elem->childs[c]);
if (xsdAttr != NULL) xType->attributesV.push_back (xsdAttr);
} else
if (matchesElementNameOnly (elem->childs[c]->name, "attributeGroup") ) {
if(debug>5)
cout << "\n\t\t\t attemptToMake-XSD-Type-Defn() => Got an attributeGroup.. ";
XSDAttributeGroup *xsdAttrGrp = attemptToMakeXSDAttributeGroup (elem->childs[c]);
if (xsdAttrGrp != NULL) xType->attrGroupsV.push_back (xsdAttrGrp);
} else
if (matchesElementNameOnly (elem->childs[c]->name, "complexContent") ) {
XMLelement *celem = elem->childs[c];
for (int f=0; f<celem->childs.size(); ++f) {
if (matchesElementNameOnly(celem->childs[f]->name, "extension")) {
char *typeName = celem->childs[f]->getAttributeValue("base");
if (typeName != NULL) { // Extension of this type...
XSDType *toExtendType = getXSDType (typeName);
if (toExtendType != NULL) {
xType->extensionOf = toExtendType;
extendXSDType (xType, toExtendType);
fillUpDetailsForXSDType (xType, celem->childs[f]);//Carry on
} else {
XSDElementDefinition *toExtendElem =
getXSDElementDefinition (typeName);
if (toExtendElem != NULL) {
xType->extensionOf = toExtendElem->xType;
extendXSDType (xType, toExtendElem->xType);
fillUpDetailsForXSDType (xType, celem->childs[f]);
//cout << "\n --------------------------------------";
//xType->print();
//cout << "\n --------------------------------------"<<flush;
} else {
sdd->incompleteWorksV.push_back (
new IncompleteWork (celem->childs[f], xType, "extension"));
if (1==2) {
sdd->eleM = celem->childs[f];
this->setString ( sdd->fileNameInWhichErrorOccurred,
this->schemaFileName);
sprintf (buf, " fillUpDetailsFor-XSD-Type-Defn() => The base [%s] of extension has not been defined ",
typeName);
popError (10, buf);
assert (1==2);
}
}
}
}
}
}
} else {
sdd->eleM = elem;
this->setString (sdd->fileNameInWhichErrorOccurred, this->schemaFileName);
sprintf (buf, " fillUpDetailsFor-XSD-Type-Defn() => Child [%s] NOT HANDLED ", elem->childs[c]->name);
popError (10, buf);
assert (1==2); // No other child element is allowed.
}
}
}//!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!_!
void
XSDparser::extendXSDType (XSDType *newerType, XSDType *olderType) {
if (olderType->nst != NULL) {
if (newerType->nst == NULL) newerType->nst = new XSDNestedStructure();
newerType->nst->addToNestedStructure (olderType->nst);
// for (int k=0; k<olderType->nst->xLeafV.size(); ++k) {
// newerType->nst->xLeafV.push_back (olderType->nst->xLeafV[k]);
//}
}
for (int k=0; k<olderType->attributesV.size(); ++k) {
newerType->attributesV.push_back (olderType->attributesV[k]);
}
for (int k=0; k<olderType->attrGroupsV.size(); ++k) {