forked from GNOME/libxml2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DOCBparser.c
6107 lines (5727 loc) · 216 KB
/
DOCBparser.c
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
/*
* DOCBparser.c : an attempt to parse SGML Docbook documents
*
* This is extremely hackish. It also adds one extension
* <?sgml-declaration encoding="ISO-8859-1"?>
* allowing to store the encoding of the document within the instance.
*
* See Copyright for the status of this software.
*
*/
#define IN_LIBXML
#include "libxml.h"
#ifdef LIBXML_DOCB_ENABLED
#include <string.h>
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
#include <libxml/xmlmemory.h>
#include <libxml/tree.h>
#include <libxml/SAX.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/xmlerror.h>
#include <libxml/DOCBparser.h>
#include <libxml/entities.h>
#include <libxml/encoding.h>
#include <libxml/valid.h>
#include <libxml/xmlIO.h>
#include <libxml/uri.h>
#include <libxml/globals.h>
/*
* DocBook XML current versions
*/
#define XML_DOCBOOK_XML_PUBLIC (const xmlChar *) \
"-//OASIS//DTD DocBook XML V4.1.2//EN"
#define XML_DOCBOOK_XML_SYSTEM (const xmlChar *) \
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
/*
* Internal description of an SGML entity
*/
typedef struct _docbEntityDesc docbEntityDesc;
typedef docbEntityDesc *docbEntityDescPtr;
struct _docbEntityDesc {
int value; /* the UNICODE value for the character */
const char *name; /* The entity name */
const char *desc; /* the description */
};
static int docbParseCharRef(docbParserCtxtPtr ctxt);
static xmlEntityPtr docbParseEntityRef(docbParserCtxtPtr ctxt,
xmlChar **str);
static void docbParseElement(docbParserCtxtPtr ctxt);
static void docbParseContent(docbParserCtxtPtr ctxt);
/*
* Internal description of an SGML element
*/
typedef struct _docbElemDesc docbElemDesc;
typedef docbElemDesc *docbElemDescPtr;
struct _docbElemDesc {
const char *name; /* The tag name */
int startTag; /* Whether the start tag can be implied */
int endTag; /* Whether the end tag can be implied */
int empty; /* Is this an empty element ? */
int depr; /* Is this a deprecated element ? */
int dtd; /* 1: only in Loose DTD, 2: only Frameset one */
const char *desc; /* the description */
};
#define DOCB_MAX_NAMELEN 1000
#define DOCB_PARSER_BIG_BUFFER_SIZE 1000
#define DOCB_PARSER_BUFFER_SIZE 100
/* #define DEBUG */
/* #define DEBUG_PUSH */
/************************************************************************
* *
* Parser stacks related functions and macros *
* *
************************************************************************/
/**
* docbnamePush:
* @ctxt: a DocBook SGML parser context
* @value: the element name
*
* Pushes a new element name on top of the name stack
*
* Returns 0 in case of error, the index in the stack otherwise
*/
static int
docbnamePush(docbParserCtxtPtr ctxt, xmlChar * value)
{
if (ctxt->nameNr >= ctxt->nameMax) {
ctxt->nameMax *= 2;
ctxt->nameTab =
(xmlChar * *)xmlRealloc(ctxt->nameTab,
ctxt->nameMax *
sizeof(ctxt->nameTab[0]));
if (ctxt->nameTab == NULL) {
xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
return (0);
}
}
ctxt->nameTab[ctxt->nameNr] = value;
ctxt->name = value;
return (ctxt->nameNr++);
}
/**
* docbnamePop:
* @ctxt: a DocBook SGML parser context
*
* Pops the top element name from the name stack
*
* Returns the name just removed
*/
static xmlChar *
docbnamePop(docbParserCtxtPtr ctxt)
{
xmlChar *ret;
if (ctxt->nameNr < 0)
return (0);
ctxt->nameNr--;
if (ctxt->nameNr < 0)
return (0);
if (ctxt->nameNr > 0)
ctxt->name = ctxt->nameTab[ctxt->nameNr - 1];
else
ctxt->name = NULL;
ret = ctxt->nameTab[ctxt->nameNr];
ctxt->nameTab[ctxt->nameNr] = 0;
return (ret);
}
/*
* Macros for accessing the content. Those should be used only by the parser,
* and not exported.
*
* Dirty macros, i.e. one need to make assumption on the context to use them
*
* CUR_PTR return the current pointer to the xmlChar to be parsed.
* CUR returns the current xmlChar value, i.e. a 8 bit value if compiled
* in ISO-Latin or UTF-8, and the current 16 bit value if compiled
* in UNICODE mode. This should be used internally by the parser
* only to compare to ASCII values otherwise it would break when
* running with UTF-8 encoding.
* NXT(n) returns the n'th next xmlChar. Same as CUR is should be used only
* to compare on ASCII based substring.
* UPP(n) returns the n'th next xmlChar converted to uppercase. Same as CUR
* it should be used only to compare on ASCII based substring.
* SKIP(n) Skip n xmlChar, and must also be used only to skip ASCII defined
* strings within the parser.
*
* Clean macros, not dependent of an ASCII context, expect UTF-8 encoding
*
* CURRENT Returns the current char value, with the full decoding of
* UTF-8 if we are using this mode. It returns an int.
* NEXT Skip to the next character, this does the proper decoding
* in UTF-8 mode. It also pop-up unfinished entities on the fly.
* COPY(to) copy one char to *to, increment CUR_PTR and to accordingly
*/
#define UPPER (toupper(*ctxt->input->cur))
#define SKIP(val) ctxt->nbChars += (val),ctxt->input->cur += (val)
#define NXT(val) ctxt->input->cur[(val)]
#define UPP(val) (toupper(ctxt->input->cur[(val)]))
#define CUR_PTR ctxt->input->cur
#define SHRINK xmlParserInputShrink(ctxt->input)
#define GROW xmlParserInputGrow(ctxt->input, INPUT_CHUNK)
#define CURRENT ((int) (*ctxt->input->cur))
#define SKIP_BLANKS docbSkipBlankChars(ctxt)
/* Imported from XML */
/* #define CUR (ctxt->token ? ctxt->token : (int) (*ctxt->input->cur)) */
#define CUR ((int) (*ctxt->input->cur))
#define NEXT xmlNextChar(ctxt),ctxt->nbChars++
#define RAW (ctxt->token ? -1 : (*ctxt->input->cur))
#define NXT(val) ctxt->input->cur[(val)]
#define CUR_PTR ctxt->input->cur
#define NEXTL(l) do { \
if (*(ctxt->input->cur) == '\n') { \
ctxt->input->line++; ctxt->input->col = 1; \
} else ctxt->input->col++; \
ctxt->token = 0; ctxt->input->cur += l; ctxt->nbChars++; \
} while (0)
/************
\
if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \
if (*ctxt->input->cur == '&') xmlParserHandleReference(ctxt);
************/
#define CUR_CHAR(l) docbCurrentChar(ctxt, &l)
#define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
#define COPY_BUF(l,b,i,v) \
if (l == 1) b[i++] = (xmlChar) v; \
else i += xmlCopyChar(l,&b[i],v)
/**
* docbCurrentChar:
* @ctxt: the DocBook SGML parser context
* @len: pointer to the length of the char read
*
* The current char value, if using UTF-8 this may actually span multiple
* bytes in the input buffer. Implement the end of line normalization:
* 2.11 End-of-Line Handling
* If the encoding is unspecified, in the case we find an ISO-Latin-1
* char, then the encoding converter is plugged in automatically.
*
* Returns the current char value and its length
*/
static int
docbCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
if (ctxt->instate == XML_PARSER_EOF)
return(0);
if (ctxt->token != 0) {
*len = 0;
return(ctxt->token);
}
if (ctxt->charset == XML_CHAR_ENCODING_UTF8) {
/*
* We are supposed to handle UTF8, check it's valid
* From rfc2044: encoding of the Unicode values on UTF-8:
*
* UCS-4 range (hex.) UTF-8 octet sequence (binary)
* 0000 0000-0000 007F 0xxxxxxx
* 0000 0080-0000 07FF 110xxxxx 10xxxxxx
* 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx
*
* Check for the 0x110000 limit too
*/
const unsigned char *cur = ctxt->input->cur;
unsigned char c;
unsigned int val;
c = *cur;
if (c & 0x80) {
if (cur[1] == 0)
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
if ((cur[1] & 0xc0) != 0x80)
goto encoding_error;
if ((c & 0xe0) == 0xe0) {
if (cur[2] == 0)
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
if ((cur[2] & 0xc0) != 0x80)
goto encoding_error;
if ((c & 0xf0) == 0xf0) {
if (cur[3] == 0)
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
if (((c & 0xf8) != 0xf0) ||
((cur[3] & 0xc0) != 0x80))
goto encoding_error;
/* 4-byte code */
*len = 4;
val = (cur[0] & 0x7) << 18;
val |= (cur[1] & 0x3f) << 12;
val |= (cur[2] & 0x3f) << 6;
val |= cur[3] & 0x3f;
} else {
/* 3-byte code */
*len = 3;
val = (cur[0] & 0xf) << 12;
val |= (cur[1] & 0x3f) << 6;
val |= cur[2] & 0x3f;
}
} else {
/* 2-byte code */
*len = 2;
val = (cur[0] & 0x1f) << 6;
val |= cur[1] & 0x3f;
}
if (!IS_CHAR(val)) {
ctxt->errNo = XML_ERR_INVALID_ENCODING;
if ((ctxt->sax != NULL) &&
(ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData,
"Char 0x%X out of allowed range\n", val);
ctxt->wellFormed = 0;
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
}
return(val);
} else {
/* 1-byte code */
*len = 1;
return((int) *ctxt->input->cur);
}
}
/*
* Assume it's a fixed length encoding (1) with
* a compatible encoding for the ASCII set, since
* XML constructs only use < 128 chars
*/
*len = 1;
if ((int) *ctxt->input->cur < 0x80)
return((int) *ctxt->input->cur);
/*
* Humm this is bad, do an automatic flow conversion
*/
xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1);
ctxt->charset = XML_CHAR_ENCODING_UTF8;
return(xmlCurrentChar(ctxt, len));
encoding_error:
/*
* If we detect an UTF8 error that probably mean that the
* input encoding didn't get properly advertized in the
* declaration header. Report the error and switch the encoding
* to ISO-Latin-1 (if you don't like this policy, just declare the
* encoding !)
*/
ctxt->errNo = XML_ERR_INVALID_ENCODING;
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) {
ctxt->sax->error(ctxt->userData,
"Input is not proper UTF-8, indicate encoding !\n");
ctxt->sax->error(ctxt->userData, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
ctxt->input->cur[0], ctxt->input->cur[1],
ctxt->input->cur[2], ctxt->input->cur[3]);
}
ctxt->charset = XML_CHAR_ENCODING_8859_1;
*len = 1;
return((int) *ctxt->input->cur);
}
#if 0
/**
* sgmlNextChar:
* @ctxt: the DocBook SGML parser context
*
* Skip to the next char input char.
*/
static void
sgmlNextChar(docbParserCtxtPtr ctxt) {
if (ctxt->instate == XML_PARSER_EOF)
return;
if ((*ctxt->input->cur == 0) &&
(xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) {
xmlPopInput(ctxt);
} else {
if (*(ctxt->input->cur) == '\n') {
ctxt->input->line++; ctxt->input->col = 1;
} else ctxt->input->col++;
ctxt->input->cur++;
ctxt->nbChars++;
if (*ctxt->input->cur == 0)
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
}
}
#endif
/**
* docbSkipBlankChars:
* @ctxt: the DocBook SGML parser context
*
* skip all blanks character found at that point in the input streams.
*
* Returns the number of space chars skipped
*/
static int
docbSkipBlankChars(xmlParserCtxtPtr ctxt) {
int res = 0;
while (IS_BLANK(*(ctxt->input->cur))) {
if ((*ctxt->input->cur == 0) &&
(xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) {
xmlPopInput(ctxt);
} else {
if (*(ctxt->input->cur) == '\n') {
ctxt->input->line++; ctxt->input->col = 1;
} else ctxt->input->col++;
ctxt->input->cur++;
ctxt->nbChars++;
if (*ctxt->input->cur == 0)
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
}
res++;
}
return(res);
}
/************************************************************************
* *
* The list of SGML elements and their properties *
* *
************************************************************************/
/*
* Start Tag: 1 means the start tag can be ommited
* End Tag: 1 means the end tag can be ommited
* 2 means it's forbidden (empty elements)
* Depr: this element is deprecated
* DTD: 1 means that this element is valid only in the Loose DTD
* 2 means that this element is valid only in the Frameset DTD
*
* Name,Start Tag,End Tag, Empty, Depr., DTD, Description
*/
static docbElemDesc
docbookElementTable[] = {
{ "abbrev", 0, 0, 0, 3, 0, "" }, /* word */
{ "abstract", 0, 0, 0, 9, 0, "" }, /* title */
{ "accel", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "ackno", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "acronym", 0, 0, 0, 3, 0, "" }, /* word */
{ "action", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "address", 0, 0, 0, 1, 0, "" },
{ "affiliation",0, 0, 0, 9, 0, "" }, /* shortaffil */
{ "alt", 0, 0, 0, 1, 0, "" },
{ "anchor", 0, 2, 1, 0, 0, "" },
{ "answer", 0, 0, 0, 9, 0, "" }, /* label */
{ "appendix", 0, 0, 0, 9, 0, "" }, /* appendixinfo */
{ "appendixinfo",0, 0, 0, 9, 0, "" }, /* graphic */
{ "application",0, 0, 0, 2, 0, "" }, /* para */
{ "area", 0, 2, 1, 0, 0, "" },
{ "areaset", 0, 0, 0, 9, 0, "" }, /* area */
{ "areaspec", 0, 0, 0, 9, 0, "" }, /* area */
{ "arg", 0, 0, 0, 1, 0, "" },
{ "artheader", 0, 0, 0, 9, 0, "" },
{ "article", 0, 0, 0, 9, 0, "" }, /* div.title.content */
{ "articleinfo",0, 0, 0, 9, 0, "" }, /* graphic */
{ "artpagenums",0, 0, 0, 4, 0, "" }, /* docinfo */
{ "attribution",0, 0, 0, 2, 0, "" }, /* para */
{ "audiodata", 0, 2, 1, 0, 0, "" },
{ "audioobject",0, 0, 0, 9, 0, "" }, /* objectinfo */
{ "authorblurb",0, 0, 0, 9, 0, "" }, /* title */
{ "authorgroup",0, 0, 0, 9, 0, "" }, /* author */
{ "authorinitials",0, 0, 0, 4, 0, "" }, /* docinfo */
{ "author", 0, 0, 0, 9, 0, "" }, /* person.ident.mix */
{ "beginpage", 0, 2, 1, 0, 0, "" },
{ "bibliodiv", 0, 0, 0, 9, 0, "" }, /* sect.title.content */
{ "biblioentry",0, 0, 0, 9, 0, "" }, /* articleinfo */
{ "bibliography",0, 0, 0, 9, 0, "" }, /* bibliographyinfo */
{ "bibliographyinfo",0, 0, 0, 9, 0, "" }, /* graphic */
{ "bibliomisc", 0, 0, 0, 2, 0, "" }, /* para */
{ "bibliomixed",0, 0, 0, 1, 0, "" }, /* %bibliocomponent.mix, bibliomset) */
{ "bibliomset", 0, 0, 0, 1, 0, "" }, /* %bibliocomponent.mix; | bibliomset) */
{ "biblioset", 0, 0, 0, 9, 0, "" }, /* bibliocomponent.mix */
{ "blockquote", 0, 0, 0, 9, 0, "" }, /* title */
{ "book", 0, 0, 0, 9, 0, "" }, /* div.title.content */
{ "bookinfo", 0, 0, 0, 9, 0, "" }, /* graphic */
{ "bridgehead", 0, 0, 0, 8, 0, "" }, /* title */
{ "callout", 0, 0, 0, 9, 0, "" }, /* component.mix */
{ "calloutlist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
{ "caption", 0, 0, 0, 9, 0, "" }, /* textobject.mix */
{ "caution", 0, 0, 0, 9, 0, "" }, /* title */
{ "chapter", 0, 0, 0, 9, 0, "" }, /* chapterinfo */
{ "chapterinfo",0, 0, 0, 9, 0, "" }, /* graphic */
{ "citation", 0, 0, 0, 2, 0, "" }, /* para */
{ "citerefentry",0, 0, 0, 9, 0, "" }, /* refentrytitle */
{ "citetitle", 0, 0, 0, 2, 0, "" }, /* para */
{ "city", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "classname", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "classsynopsisinfo",0,0, 0, 9, 0, "" }, /* cptr */
{ "classsynopsis",0, 0, 0, 9, 0, "" }, /* ooclass */
{ "cmdsynopsis",0, 0, 0, 9, 0, "" }, /* command */
{ "co", 0, 2, 1, 0, 0, "" },
{ "collab", 0, 0, 0, 9, 0, "" }, /* collabname */
{ "collabname", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "colophon", 0, 0, 0, 9, 0, "" }, /* sect.title.content */
{ "colspec", 0, 2, 1, 0, 0, "" },
{ "colspec", 0, 2, 1, 0, 0, "" },
{ "command", 0, 0, 0, 9, 0, "" }, /* cptr */
{ "computeroutput",0, 0, 0, 9, 0, "" }, /* cptr */
{ "confdates", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "confgroup", 0, 0, 0, 9, 0, "" }, /* confdates */
{ "confnum", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "confsponsor",0, 0, 0, 4, 0, "" }, /* docinfo */
{ "conftitle", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "constant", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "constructorsynopsis",0,0, 0, 9, 0, "" }, /* modifier */
{ "contractnum",0, 0, 0, 4, 0, "" }, /* docinfo */
{ "contractsponsor",0, 0, 0, 4, 0, "" }, /* docinfo */
{ "contrib", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "copyright", 0, 0, 0, 9, 0, "" }, /* year */
{ "corpauthor", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "corpname", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "country", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "database", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "date", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "dedication", 0, 0, 0, 9, 0, "" }, /* sect.title.content */
{ "destructorsynopsis",0,0, 0, 9, 0, "" }, /* modifier */
{ "docinfo", 0, 0, 0, 9, 0, "" },
{ "edition", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "editor", 0, 0, 0, 9, 0, "" }, /* person.ident.mix */
{ "email", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "emphasis", 0, 0, 0, 2, 0, "" }, /* para */
{ "entry", 0, 0, 0, 9, 0, "" }, /* tbl.entry.mdl */
{ "entrytbl", 0, 0, 0, 9, 0, "" }, /* tbl.entrytbl.mdl */
{ "envar", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "epigraph", 0, 0, 0, 9, 0, "" }, /* attribution */
{ "equation", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
{ "errorcode", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "errorname", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "errortype", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "example", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
{ "exceptionname",0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "fax", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "fieldsynopsis", 0, 0, 0, 9, 0, "" }, /* modifier */
{ "figure", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
{ "filename", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "firstname", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "firstterm", 0, 0, 0, 3, 0, "" }, /* word */
{ "footnote", 0, 0, 0, 9, 0, "" }, /* footnote.mix */
{ "footnoteref",0, 2, 1, 0, 0, "" },
{ "foreignphrase",0, 0, 0, 2, 0, "" }, /* para */
{ "formalpara", 0, 0, 0, 9, 0, "" }, /* title */
{ "funcdef", 0, 0, 0, 1, 0, "" },
{ "funcparams", 0, 0, 0, 9, 0, "" }, /* cptr */
{ "funcprototype",0, 0, 0, 9, 0, "" }, /* funcdef */
{ "funcsynopsis",0, 0, 0, 9, 0, "" }, /* funcsynopsisinfo */
{ "funcsynopsisinfo", 0, 0, 0, 9, 0, "" }, /* cptr */
{ "function", 0, 0, 0, 9, 0, "" }, /* cptr */
{ "glossary", 0, 0, 0, 9, 0, "" }, /* glossaryinfo */
{ "glossaryinfo",0, 0, 0, 9, 0, "" }, /* graphic */
{ "glossdef", 0, 0, 0, 9, 0, "" }, /* glossdef.mix */
{ "glossdiv", 0, 0, 0, 9, 0, "" }, /* sect.title.content */
{ "glossentry", 0, 0, 0, 9, 0, "" }, /* glossterm */
{ "glosslist", 0, 0, 0, 9, 0, "" }, /* glossentry */
{ "glossseealso",0, 0, 1, 2, 0, "" }, /* para */
{ "glosssee", 0, 0, 1, 2, 0, "" }, /* para */
{ "glossterm", 0, 0, 0, 2, 0, "" }, /* para */
{ "graphic", 0, 0, 0, 9, 0, "" },
{ "graphicco", 0, 0, 0, 9, 0, "" }, /* areaspec */
{ "group", 0, 0, 0, 9, 0, "" }, /* arg */
{ "guibutton", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "guiicon", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "guilabel", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "guimenuitem",0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "guimenu", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "guisubmenu", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "hardware", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "highlights", 0, 0, 0, 9, 0, "" }, /* highlights.mix */
{ "holder", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "honorific", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "imagedata", 0, 2, 1, 0, 0, "" },
{ "imageobjectco",0, 0, 0, 9, 0, "" }, /* areaspec */
{ "imageobject",0, 0, 0, 9, 0, "" }, /* objectinfo */
{ "important", 0, 0, 0, 9, 0, "" }, /* title */
{ "indexdiv", 0, 0, 0, 9, 0, "" }, /* sect.title.content */
{ "indexentry", 0, 0, 0, 9, 0, "" }, /* primaryie */
{ "index", 0, 0, 0, 9, 0, "" }, /* indexinfo */
{ "indexinfo", 0, 0, 0, 9, 0, "" }, /* graphic */
{ "indexterm", 0, 0, 0, 9, 0, "" }, /* primary */
{ "informalequation",0, 0, 0, 9, 0, "" }, /* equation.content */
{ "informalexample",0, 0, 0, 9, 0, "" }, /* example.mix */
{ "informalfigure",0, 0, 0, 9, 0, "" }, /* figure.mix */
{ "informaltable",0, 0, 0, 9, 0, "" }, /* graphic */
{ "initializer",0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "inlineequation",0, 0, 0, 9, 0, "" }, /* inlineequation.content */
{ "inlinegraphic",0, 0, 0, 9, 0, "" },
{ "inlinemediaobject",0,0, 0, 9, 0, "" }, /* objectinfo */
{ "interfacename",0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "interface", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "invpartnumber",0, 0, 0, 4, 0, "" }, /* docinfo */
{ "isbn", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "issn", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "issuenum", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "itemizedlist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
{ "itermset", 0, 0, 0, 9, 0, "" }, /* indexterm */
{ "jobtitle", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "keycap", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "keycode", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "keycombo", 0, 0, 0, 9, 0, "" }, /* keycap */
{ "keysym", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "keyword", 0, 0, 0, 1, 0, "" },
{ "keywordset", 0, 0, 0, 9, 0, "" }, /* keyword */
{ "label", 0, 0, 0, 3, 0, "" }, /* word */
{ "legalnotice",0, 0, 0, 9, 0, "" }, /* title */
{ "lineage", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "lineannotation",0, 0, 0, 2, 0, "" }, /* para */
{ "link", 0, 0, 0, 2, 0, "" }, /* para */
{ "listitem", 0, 0, 0, 9, 0, "" }, /* component.mix */
{ "literal", 0, 0, 0, 9, 0, "" }, /* cptr */
{ "literallayout",0, 0, 0, 2, 0, "" }, /* para */
{ "lot", 0, 0, 0, 9, 0, "" }, /* bookcomponent.title.content */
{ "lotentry", 0, 0, 0, 2, 0, "" }, /* para */
{ "manvolnum", 0, 0, 0, 3, 0, "" }, /* word */
{ "markup", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "medialabel", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "mediaobjectco",0, 0, 0, 9, 0, "" }, /* objectinfo */
{ "mediaobject",0, 0, 0, 9, 0, "" }, /* objectinfo */
{ "member", 0, 0, 0, 2, 0, "" }, /* para */
{ "menuchoice", 0, 0, 0, 9, 0, "" }, /* shortcut */
{ "methodname", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "methodparam",0, 0, 0, 9, 0, "" }, /* modifier */
{ "methodsynopsis",0, 0, 0, 9, 0, "" }, /* modifier */
{ "modespec", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "modifier", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "mousebutton",0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "msgaud", 0, 0, 0, 2, 0, "" }, /* para */
{ "msgentry", 0, 0, 0, 9, 0, "" }, /* msg */
{ "msgexplan", 0, 0, 0, 9, 0, "" }, /* title */
{ "msginfo", 0, 0, 0, 9, 0, "" }, /* msglevel */
{ "msglevel", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "msgmain", 0, 0, 0, 9, 0, "" }, /* title */
{ "msgorig", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "msgrel", 0, 0, 0, 9, 0, "" }, /* title */
{ "msgset", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
{ "msgsub", 0, 0, 0, 9, 0, "" }, /* title */
{ "msgtext", 0, 0, 0, 9, 0, "" }, /* component.mix */
{ "msg", 0, 0, 0, 9, 0, "" }, /* title */
{ "note", 0, 0, 0, 9, 0, "" }, /* title */
{ "objectinfo", 0, 0, 0, 9, 0, "" }, /* graphic */
{ "olink", 0, 0, 0, 2, 0, "" }, /* para */
{ "ooclass", 0, 0, 0, 9, 0, "" }, /* modifier */
{ "ooexception",0, 0, 0, 9, 0, "" }, /* modifier */
{ "oointerface",0, 0, 0, 9, 0, "" }, /* modifier */
{ "optional", 0, 0, 0, 9, 0, "" }, /* cptr */
{ "option", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "orderedlist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
{ "orgdiv", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "orgname", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "otheraddr", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "othercredit",0, 0, 0, 9, 0, "" }, /* person.ident.mix */
{ "othername", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "pagenums", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "paramdef", 0, 0, 0, 1, 0, "" },
{ "parameter", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "para", 0, 0, 0, 2, 0, "" }, /* para */
{ "partinfo", 0, 0, 0, 9, 0, "" }, /* graphic */
{ "partintro", 0, 0, 0, 9, 0, "" }, /* div.title.content */
{ "part", 0, 0, 0, 9, 0, "" }, /* partinfo */
{ "phone", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "phrase", 0, 0, 0, 2, 0, "" }, /* para */
{ "pob", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "postcode", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "prefaceinfo",0, 0, 0, 9, 0, "" }, /* graphic */
{ "preface", 0, 0, 0, 9, 0, "" }, /* prefaceinfo */
{ "primaryie", 0, 0, 0, 4, 0, "" }, /* ndxterm */
{ "primary", 0, 0, 0, 9, 0, "" }, /* ndxterm */
{ "printhistory",0, 0, 0, 9, 0, "" }, /* para.class */
{ "procedure", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
{ "productname",0, 0, 0, 2, 0, "" }, /* para */
{ "productnumber",0, 0, 0, 4, 0, "" }, /* docinfo */
{ "programlistingco",0, 0, 0, 9, 0, "" }, /* areaspec */
{ "programlisting",0, 0, 0, 2, 0, "" }, /* para */
{ "prompt", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "property", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "pubdate", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "publishername",0, 0, 0, 4, 0, "" }, /* docinfo */
{ "publisher", 0, 0, 0, 9, 0, "" }, /* publishername */
{ "pubsnumber", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "qandadiv", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
{ "qandaentry", 0, 0, 0, 9, 0, "" }, /* revhistory */
{ "qandaset", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
{ "question", 0, 0, 0, 9, 0, "" }, /* label */
{ "quote", 0, 0, 0, 2, 0, "" }, /* para */
{ "refclass", 0, 0, 0, 9, 0, "" }, /* refclass.char.mix */
{ "refdescriptor",0, 0, 0, 9, 0, "" }, /* refname.char.mix */
{ "refentryinfo",0, 0, 0, 9, 0, "" }, /* graphic */
{ "refentry", 0, 0, 0, 9, 0, "" }, /* ndxterm.class */
{ "refentrytitle",0, 0, 0, 2, 0, "" }, /* para */
{ "referenceinfo",0, 0, 0, 9, 0, "" }, /* graphic */
{ "reference", 0, 0, 0, 9, 0, "" }, /* referenceinfo */
{ "refmeta", 0, 0, 0, 9, 0, "" }, /* ndxterm.class */
{ "refmiscinfo",0, 0, 0, 4, 0, "" }, /* docinfo */
{ "refnamediv", 0, 0, 0, 9, 0, "" }, /* refdescriptor */
{ "refname", 0, 0, 0, 9, 0, "" }, /* refname.char.mix */
{ "refpurpose", 0, 0, 0, 9, 0, "" }, /* refinline.char.mix */
{ "refsect1info",0, 0, 0, 9, 0, "" }, /* graphic */
{ "refsect1", 0, 0, 0, 9, 0, "" }, /* refsect */
{ "refsect2info",0, 0, 0, 9, 0, "" }, /* graphic */
{ "refsect2", 0, 0, 0, 9, 0, "" }, /* refsect */
{ "refsect3info",0, 0, 0, 9, 0, "" }, /* graphic */
{ "refsect3", 0, 0, 0, 9, 0, "" }, /* refsect */
{ "refsynopsisdivinfo",0,0, 0, 9, 0, "" }, /* graphic */
{ "refsynopsisdiv",0, 0, 0, 9, 0, "" }, /* refsynopsisdivinfo */
{ "releaseinfo",0, 0, 0, 4, 0, "" }, /* docinfo */
{ "remark", 0, 0, 0, 2, 0, "" }, /* para */
{ "replaceable",0, 0, 0, 1, 0, "" },
{ "returnvalue",0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "revdescription",0, 0, 0, 9, 0, "" }, /* revdescription.mix */
{ "revhistory", 0, 0, 0, 9, 0, "" }, /* revision */
{ "revision", 0, 0, 0, 9, 0, "" }, /* revnumber */
{ "revnumber", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "revremark", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "row", 0, 0, 0, 9, 0, "" }, /* tbl.row.mdl */
{ "row", 0, 0, 0, 9, 0, "" }, /* tbl.row.mdl */
{ "sbr", 0, 2, 1, 0, 0, "" },
{ "screenco", 0, 0, 0, 9, 0, "" }, /* areaspec */
{ "screeninfo", 0, 0, 0, 2, 0, "" }, /* para */
{ "screen", 0, 0, 0, 2, 0, "" }, /* para */
{ "screenshot", 0, 0, 0, 9, 0, "" }, /* screeninfo */
{ "secondaryie",0, 0, 0, 4, 0, "" }, /* ndxterm */
{ "secondary", 0, 0, 0, 4, 0, "" }, /* ndxterm */
{ "sect1info", 0, 0, 0, 9, 0, "" }, /* graphic */
{ "sect1", 0, 0, 0, 9, 0, "" }, /* sect */
{ "sect2info", 0, 0, 0, 9, 0, "" }, /* graphic */
{ "sect2", 0, 0, 0, 9, 0, "" }, /* sect */
{ "sect3info", 0, 0, 0, 9, 0, "" }, /* graphic */
{ "sect3", 0, 0, 0, 9, 0, "" }, /* sect */
{ "sect4info", 0, 0, 0, 9, 0, "" }, /* graphic */
{ "sect4", 0, 0, 0, 9, 0, "" }, /* sect */
{ "sect5info", 0, 0, 0, 9, 0, "" }, /* graphic */
{ "sect5", 0, 0, 0, 9, 0, "" }, /* sect */
{ "sectioninfo",0, 0, 0, 9, 0, "" }, /* graphic */
{ "section", 0, 0, 0, 9, 0, "" }, /* sectioninfo */
{ "seealsoie", 0, 0, 0, 4, 0, "" }, /* ndxterm */
{ "seealso", 0, 0, 0, 4, 0, "" }, /* ndxterm */
{ "seeie", 0, 0, 0, 4, 0, "" }, /* ndxterm */
{ "see", 0, 0, 0, 4, 0, "" }, /* ndxterm */
{ "seglistitem",0, 0, 0, 9, 0, "" }, /* seg */
{ "segmentedlist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
{ "seg", 0, 0, 0, 2, 0, "" }, /* para */
{ "segtitle", 0, 0, 0, 8, 0, "" }, /* title */
{ "seriesvolnums", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "set", 0, 0, 0, 9, 0, "" }, /* div.title.content */
{ "setindexinfo",0, 0, 0, 9, 0, "" }, /* graphic */
{ "setindex", 0, 0, 0, 9, 0, "" }, /* setindexinfo */
{ "setinfo", 0, 0, 0, 9, 0, "" }, /* graphic */
{ "sgmltag", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "shortaffil", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "shortcut", 0, 0, 0, 9, 0, "" }, /* keycap */
{ "sidebarinfo",0, 0, 0, 9, 0, "" }, /* graphic */
{ "sidebar", 0, 0, 0, 9, 0, "" }, /* sidebarinfo */
{ "simpara", 0, 0, 0, 2, 0, "" }, /* para */
{ "simplelist", 0, 0, 0, 9, 0, "" }, /* member */
{ "simplemsgentry", 0, 0, 0, 9, 0, "" }, /* msgtext */
{ "simplesect", 0, 0, 0, 9, 0, "" }, /* sect.title.content */
{ "spanspec", 0, 2, 1, 0, 0, "" },
{ "state", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "step", 0, 0, 0, 9, 0, "" }, /* title */
{ "street", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "structfield",0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "structname", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "subjectset", 0, 0, 0, 9, 0, "" }, /* subject */
{ "subject", 0, 0, 0, 9, 0, "" }, /* subjectterm */
{ "subjectterm",0, 0, 0, 1, 0, "" },
{ "subscript", 0, 0, 0, 1, 0, "" },
{ "substeps", 0, 0, 0, 9, 0, "" }, /* step */
{ "subtitle", 0, 0, 0, 8, 0, "" }, /* title */
{ "superscript", 0, 0, 0, 1, 0, "" },
{ "surname", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "symbol", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "synopfragment", 0, 0, 0, 9, 0, "" }, /* arg */
{ "synopfragmentref", 0, 0, 0, 1, 0, "" },
{ "synopsis", 0, 0, 0, 2, 0, "" }, /* para */
{ "systemitem", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "table", 0, 0, 0, 9, 0, "" }, /* tbl.table.mdl */
/* { "%tbl.table.name;", 0, 0, 0, 9, 0, "" },*/ /* tbl.table.mdl */
{ "tbody", 0, 0, 0, 9, 0, "" }, /* row */
{ "tbody", 0, 0, 0, 9, 0, "" }, /* row */
{ "term", 0, 0, 0, 2, 0, "" }, /* para */
{ "tertiaryie", 0, 0, 0, 4, 0, "" }, /* ndxterm */
{ "tertiary ", 0, 0, 0, 4, 0, "" }, /* ndxterm */
{ "textobject", 0, 0, 0, 9, 0, "" }, /* objectinfo */
{ "tfoot", 0, 0, 0, 9, 0, "" }, /* tbl.hdft.mdl */
{ "tgroup", 0, 0, 0, 9, 0, "" }, /* tbl.tgroup.mdl */
{ "tgroup", 0, 0, 0, 9, 0, "" }, /* tbl.tgroup.mdl */
{ "thead", 0, 0, 0, 9, 0, "" }, /* row */
{ "thead", 0, 0, 0, 9, 0, "" }, /* tbl.hdft.mdl */
{ "tip", 0, 0, 0, 9, 0, "" }, /* title */
{ "titleabbrev",0, 0, 0, 8, 0, "" }, /* title */
{ "title", 0, 0, 0, 8, 0, "" }, /* title */
{ "tocback", 0, 0, 0, 2, 0, "" }, /* para */
{ "toc", 0, 0, 0, 9, 0, "" }, /* bookcomponent.title.content */
{ "tocchap", 0, 0, 0, 9, 0, "" }, /* tocentry */
{ "tocentry", 0, 0, 0, 2, 0, "" }, /* para */
{ "tocfront", 0, 0, 0, 2, 0, "" }, /* para */
{ "toclevel1", 0, 0, 0, 9, 0, "" }, /* tocentry */
{ "toclevel2", 0, 0, 0, 9, 0, "" }, /* tocentry */
{ "toclevel3", 0, 0, 0, 9, 0, "" }, /* tocentry */
{ "toclevel4", 0, 0, 0, 9, 0, "" }, /* tocentry */
{ "toclevel5", 0, 0, 0, 9, 0, "" }, /* tocentry */
{ "tocpart", 0, 0, 0, 9, 0, "" }, /* tocentry */
{ "token", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "trademark", 0, 0, 0, 1, 0, "" },
{ "type", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "ulink", 0, 0, 0, 2, 0, "" }, /* para */
{ "userinput", 0, 0, 0, 9, 0, "" }, /* cptr */
{ "varargs", 0, 2, 1, 0, 0, "" },
{ "variablelist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
{ "varlistentry",0, 0, 0, 9, 0, "" }, /* term */
{ "varname", 0, 0, 0, 7, 0, "" }, /* smallcptr */
{ "videodata", 0, 2, 1, 0, 0, "" },
{ "videoobject",0, 0, 0, 9, 0, "" }, /* objectinfo */
{ "void", 0, 2, 1, 0, 0, "" },
{ "volumenum", 0, 0, 0, 4, 0, "" }, /* docinfo */
{ "warning", 0, 0, 0, 9, 0, "" }, /* title */
{ "wordasword", 0, 0, 0, 3, 0, "" }, /* word */
{ "xref", 0, 2, 1, 0, 0, "" },
{ "year", 0, 0, 0, 4, 0, "" }, /* docinfo */
};
#if 0
/*
* start tags that imply the end of a current element
* any tag of each line implies the end of the current element if the type of
* that element is in the same line
*/
static const char *docbEquEnd[] = {
"dt", "dd", "li", "option", NULL,
"h1", "h2", "h3", "h4", "h5", "h6", NULL,
"ol", "menu", "dir", "address", "pre", "listing", "xmp", NULL,
NULL
};
#endif
/*
* according the SGML DTD, HR should be added to the 2nd line above, as it
* is not allowed within a H1, H2, H3, etc. But we should tolerate that case
* because many documents contain rules in headings...
*/
/*
* start tags that imply the end of current element
*/
static const char *docbStartClose[] = {
NULL
};
static const char** docbStartCloseIndex[100];
static int docbStartCloseIndexinitialized = 0;
/************************************************************************
* *
* functions to handle SGML specific data *
* *
************************************************************************/
/**
* docbInitAutoClose:
*
* Initialize the docbStartCloseIndex for fast lookup of closing tags names.
*
*/
static void
docbInitAutoClose(void) {
int indx, i = 0;
if (docbStartCloseIndexinitialized) return;
for (indx = 0;indx < 100;indx ++) docbStartCloseIndex[indx] = NULL;
indx = 0;
while ((docbStartClose[i] != NULL) && (indx < 100 - 1)) {
docbStartCloseIndex[indx++] = &docbStartClose[i];
while (docbStartClose[i] != NULL) i++;
i++;
}
}
/**
* docbTagLookup:
* @tag: The tag name
*
* Lookup the SGML tag in the ElementTable
*
* Returns the related docbElemDescPtr or NULL if not found.
*/
static docbElemDescPtr
docbTagLookup(const xmlChar *tag) {
unsigned int i;
for (i = 0; i < (sizeof(docbookElementTable) /
sizeof(docbookElementTable[0]));i++) {
if (xmlStrEqual(tag, BAD_CAST docbookElementTable[i].name))
return(&docbookElementTable[i]);
}
return(NULL);
}
/**
* docbCheckAutoClose:
* @newtag: The new tag name
* @oldtag: The old tag name
*
* Checks whether the new tag is one of the registered valid tags for
* closing old.
* Initialize the docbStartCloseIndex for fast lookup of closing tags names.
*
* Returns 0 if no, 1 if yes.
*/
static int
docbCheckAutoClose(const xmlChar *newtag, const xmlChar *oldtag) {
int i, indx;
const char **closed = NULL;
if (docbStartCloseIndexinitialized == 0) docbInitAutoClose();
/* inefficient, but not a big deal */
for (indx = 0; indx < 100;indx++) {
closed = docbStartCloseIndex[indx];
if (closed == NULL) return(0);
if (xmlStrEqual(BAD_CAST *closed, newtag)) break;
}
i = closed - docbStartClose;
i++;
while (docbStartClose[i] != NULL) {
if (xmlStrEqual(BAD_CAST docbStartClose[i], oldtag)) {
return(1);
}
i++;
}
return(0);
}
/**
* docbAutoCloseOnClose:
* @ctxt: an SGML parser context
* @newtag: The new tag name
*
* The DocBook DTD allows an ending tag to implicitly close other tags.
*/
static void
docbAutoCloseOnClose(docbParserCtxtPtr ctxt, const xmlChar *newtag) {
docbElemDescPtr info;
xmlChar *oldname;
int i;
if ((newtag[0] == '/') && (newtag[1] == 0))
return;
#ifdef DEBUG
xmlGenericError(xmlGenericErrorContext,"Close of %s stack: %d elements\n", newtag, ctxt->nameNr);
for (i = 0;i < ctxt->nameNr;i++)
xmlGenericError(xmlGenericErrorContext,"%d : %s\n", i, ctxt->nameTab[i]);
#endif
for (i = (ctxt->nameNr - 1);i >= 0;i--) {
if (xmlStrEqual(newtag, ctxt->nameTab[i])) break;
}
if (i < 0) return;
while (!xmlStrEqual(newtag, ctxt->name)) {
info = docbTagLookup(ctxt->name);
if ((info == NULL) || (info->endTag == 1)) {
#ifdef DEBUG
xmlGenericError(xmlGenericErrorContext,"docbAutoCloseOnClose: %s closes %s\n", newtag, ctxt->name);
#endif
} else {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData,
"Opening and ending tag mismatch: %s and %s\n",
newtag, ctxt->name);
ctxt->wellFormed = 0;
}
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
ctxt->sax->endElement(ctxt->userData, ctxt->name);
oldname = docbnamePop(ctxt);
if (oldname != NULL) {
#ifdef DEBUG
xmlGenericError(xmlGenericErrorContext,"docbAutoCloseOnClose: popped %s\n", oldname);
#endif
xmlFree(oldname);
}
}
}
/**
* docbAutoClose:
* @ctxt: an SGML parser context
* @newtag: The new tag name or NULL
*
* The DocBook DTD allows a tag to implicitly close other tags.