File: parser.h

package info (click to toggle)
libxml2 2.15.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid
  • size: 9,964 kB
  • sloc: ansic: 138,103; python: 6,692; sh: 4,736; xml: 1,476; makefile: 715
file content (2161 lines) | stat: -rw-r--r-- 60,306 bytes parent folder | download
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
/**
 * @file
 * 
 * @brief Validating XML 1.0 parser
 * 
 * Interfaces, constants and types related to the XML parser.
 *
 * @copyright See Copyright for the status of this software.
 *
 * @author Daniel Veillard
 */

#ifndef __XML_PARSER_H__
#define __XML_PARSER_H__

#include <libxml/xmlversion.h>
/** @cond ignore */
#define XML_TREE_INTERNALS
/** @endcond */
#include <libxml/tree.h>
#undef XML_TREE_INTERNALS
#include <libxml/dict.h>
#include <libxml/hash.h>
#include <libxml/valid.h>
#include <libxml/entities.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlstring.h>
#include <libxml/xmlmemory.h>
#include <libxml/encoding.h>
#include <libxml/xmlIO.h>
/* for compatibility */
#include <libxml/SAX2.h>
#include <libxml/threads.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * The default version of XML used: 1.0
 */
#define XML_DEFAULT_VERSION	"1.0"

/**
 * Status after parsing a document
 */
typedef enum {
    /** not well-formed */
    XML_STATUS_NOT_WELL_FORMED          = (1 << 0),
    /** not namespace-well-formed */
    XML_STATUS_NOT_NS_WELL_FORMED       = (1 << 1),
    /** DTD validation failed */
    XML_STATUS_DTD_VALIDATION_FAILED    = (1 << 2),
    /** catastrophic failure like OOM or I/O error */
    XML_STATUS_CATASTROPHIC_ERROR       = (1 << 3)
} xmlParserStatus;

/**
 * Resource type for resource loaders
 */
typedef enum {
    /** unknown */
    XML_RESOURCE_UNKNOWN = 0,
    /** main document */
    XML_RESOURCE_MAIN_DOCUMENT,
    /** external DTD */
    XML_RESOURCE_DTD,
    /** external general entity */
    XML_RESOURCE_GENERAL_ENTITY,
    /** external parameter entity */
    XML_RESOURCE_PARAMETER_ENTITY,
    /** XIncluded document */
    XML_RESOURCE_XINCLUDE,
    /** XIncluded text */
    XML_RESOURCE_XINCLUDE_TEXT
} xmlResourceType;

/**
 * Flags for parser input
 */
typedef enum {
    /** The input buffer won't be changed during parsing. */
    XML_INPUT_BUF_STATIC            = (1 << 1),
    /** The input buffer is zero-terminated. (Note that the zero
        byte shouldn't be included in buffer size.) */
    XML_INPUT_BUF_ZERO_TERMINATED   = (1 << 2),
    /** Uncompress gzipped file input */
    XML_INPUT_UNZIP                 = (1 << 3),
    /** Allow network access. Unused internally. */
    XML_INPUT_NETWORK               = (1 << 4),
    /** Allow system catalog to resolve URIs. */
    XML_INPUT_USE_SYS_CATALOG       = (1 << 5)
} xmlParserInputFlags;

/* Deprecated */
typedef void (* xmlParserInputDeallocate)(xmlChar *str);

/**
 * Parser input
 */
struct _xmlParserInput {
    /* Input buffer */
    xmlParserInputBuffer *buf XML_DEPRECATED_MEMBER;
    /**
     * @deprecated Use #xmlCtxtGetInputPosition
     *
     * The filename or URI, if any
     */
    const char *filename;
    /* unused */
    const char *directory XML_DEPRECATED_MEMBER;
    /* Base of the array to parse */
    const xmlChar *base;
    /**
     * @deprecated Use #xmlCtxtGetInputWindow
     *
     * Current char being parsed
     */
    const xmlChar *cur;
    /* end of the array to parse */
    const xmlChar *end;
    /* unused */
    int length XML_DEPRECATED_MEMBER;
    /**
     * @deprecated Use #xmlCtxtGetInputPosition
     *
     * Current line
     */
    int line;
    /**
     * @deprecated Use #xmlCtxtGetInputPosition
     *
     * Current column
     */
    int col;
    /**
     * @deprecated Use #xmlCtxtGetInputPosition
     *
     * How many xmlChars already consumed
     */
    unsigned long consumed;
    /* function to deallocate the base */
    xmlParserInputDeallocate free XML_DEPRECATED_MEMBER;
    /* unused */
    const xmlChar *encoding XML_DEPRECATED_MEMBER;
    /* the version string for entity */
    const xmlChar *version XML_DEPRECATED_MEMBER;
    /* Flags */
    int flags XML_DEPRECATED_MEMBER;
    /* an unique identifier for the entity, unused internally */
    int id XML_DEPRECATED_MEMBER;
    /* unused */
    unsigned long parentConsumed XML_DEPRECATED_MEMBER;
    /* entity, if any */
    xmlEntity *entity XML_DEPRECATED_MEMBER;
};

/** @cond ignore */

typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;

struct _xmlParserNodeInfo {
  const struct _xmlNode* node;
  /* Position & line # that text that created the node begins & ends on */
  unsigned long begin_pos;
  unsigned long begin_line;
  unsigned long end_pos;
  unsigned long end_line;
};

typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
struct _xmlParserNodeInfoSeq {
  unsigned long maximum;
  unsigned long length;
  xmlParserNodeInfo* buffer;
};

/*
 * Internal type
 */
typedef enum {
    XML_PARSER_EOF = -1,	/* nothing is to be parsed */
    XML_PARSER_START = 0,	/* nothing has been parsed */
    XML_PARSER_MISC,		/* Misc* before int subset */
    XML_PARSER_PI,		/* Within a processing instruction */
    XML_PARSER_DTD,		/* within some DTD content */
    XML_PARSER_PROLOG,		/* Misc* after internal subset */
    XML_PARSER_COMMENT,		/* within a comment */
    XML_PARSER_START_TAG,	/* within a start tag */
    XML_PARSER_CONTENT,		/* within the content */
    XML_PARSER_CDATA_SECTION,	/* within a CDATA section */
    XML_PARSER_END_TAG,		/* within a closing tag */
    XML_PARSER_ENTITY_DECL,	/* within an entity declaration */
    XML_PARSER_ENTITY_VALUE,	/* within an entity value in a decl */
    XML_PARSER_ATTRIBUTE_VALUE,	/* within an attribute value */
    XML_PARSER_SYSTEM_LITERAL,	/* within a SYSTEM value */
    XML_PARSER_EPILOG,		/* the Misc* after the last end tag */
    XML_PARSER_IGNORE,		/* within an IGNORED section */
    XML_PARSER_PUBLIC_LITERAL,	/* within a PUBLIC value */
    XML_PARSER_XML_DECL         /* before XML decl (but after BOM) */
} xmlParserInputState;

/*
 * Internal bits in the 'loadsubset' context member
 */
#define XML_DETECT_IDS		2
#define XML_COMPLETE_ATTRS	4
#define XML_SKIP_IDS		8

/*
 * Internal type. Only XML_PARSE_READER is used.
 */
typedef enum {
    XML_PARSE_UNKNOWN = 0,
    XML_PARSE_DOM = 1,
    XML_PARSE_SAX = 2,
    XML_PARSE_PUSH_DOM = 3,
    XML_PARSE_PUSH_SAX = 4,
    XML_PARSE_READER = 5
} xmlParserMode;

typedef struct _xmlStartTag xmlStartTag;
typedef struct _xmlParserNsData xmlParserNsData;
typedef struct _xmlAttrHashBucket xmlAttrHashBucket;

/** @endcond */

/**
 * Callback for custom resource loaders.
 *
 * `flags` can contain XML_INPUT_UNZIP and XML_INPUT_NETWORK.
 *
 * The URL is resolved using XML catalogs before being passed to
 * the callback.
 *
 * On success, `out` should be set to a new parser input object and
 * XML_ERR_OK should be returned.
 *
 * @param ctxt  parser context
 * @param url  URL or system ID to load
 * @param publicId  publid ID from DTD (optional)
 * @param type  resource type
 * @param flags  flags
 * @param out  result pointer
 * @returns an xmlParserErrors code.
 */
typedef xmlParserErrors
(*xmlResourceLoader)(void *ctxt, const char *url, const char *publicId,
                     xmlResourceType type, xmlParserInputFlags flags,
                     xmlParserInput **out);

/**
 * Parser context
 */
struct _xmlParserCtxt {
    /**
     * @deprecated Use xmlCtxtGetSaxHandler() and
     * xmlCtxtSetSaxHandler().
     *
     * the SAX handler
     */
    struct _xmlSAXHandler *sax;
    /**
     * @deprecated Use #xmlCtxtGetUserData
     *
     * user data for SAX interface, defaults to the context itself
     */
    void *userData;
    /**
     * @deprecated Use xmlCtxtGetDocument()
     *
     * the document being built
     */
    xmlDoc *myDoc;
    /**
     * @deprecated Use xmlCtxtGetStatus()
     *
     * is the document well formed?
     */
    int wellFormed;
    /**
     * @deprecated Use xmlParserOption XML_PARSE_NOENT
     *
     * shall we replace entities?
     */
    int replaceEntities XML_DEPRECATED_MEMBER;
    /**
     * @deprecated Use xmlCtxtGetVersion()
     *
     * the XML version string
     */
    xmlChar *version;
    /**
     * @deprecated Use xmlCtxtGetDeclaredEncoding()
     *
     * the declared encoding, if any
     */
    xmlChar *encoding;
    /**
     * @deprecated Use xmlCtxtGetStandalone()
     *
     * standalone document
     */
    int standalone;

    /**
     * @deprecated Use xmlCtxtIsHtml()
     *
     * non-zero for HTML documents, actually an htmlInsertMode
     */
    int html;

    /* Input stream stack */

    /**
     * Current input stream
     */
    /* TODO: Add accessors, see issue #762 */
    xmlParserInput *input;
    /* Number of current input streams */
    int inputNr;
    /* Max number of input streams */
    int inputMax XML_DEPRECATED_MEMBER;
    /* stack of inputs */
    xmlParserInput **inputTab;

    /* Node analysis stack only used for DOM building */

    /**
     * @deprecated Use #xmlCtxtGetNode
     *
     * The current element.
     */
    xmlNode *node;
    /* Depth of the parsing stack */
    int nodeNr XML_DEPRECATED_MEMBER;
    /* Max depth of the parsing stack */
    int nodeMax XML_DEPRECATED_MEMBER;
    /* array of nodes */
    xmlNode **nodeTab XML_DEPRECATED_MEMBER;

    /* Whether node info should be kept */
    int record_info;
    /* info about each node parsed */
    xmlParserNodeInfoSeq node_seq XML_DEPRECATED_MEMBER;

    /**
     * @deprecated Use xmlCtxtGetLastError()
     *
     * error code
     */
    int errNo;

    /* reference and external subset */
    int hasExternalSubset XML_DEPRECATED_MEMBER;
    /* the internal subset has PE refs */
    int hasPErefs XML_DEPRECATED_MEMBER;
    /* unused */
    int external XML_DEPRECATED_MEMBER;

    /**
     * @deprecated Use xmlCtxtGetStatus()
     *
     * is the document valid
     */
    int valid;
    /**
     * @deprecated Use xmlParserOption XML_PARSE_DTDVALID
     *
     * shall we try to validate?
     */
    int validate XML_DEPRECATED_MEMBER;
    /**
     * @deprecated Use xmlCtxtGetValidCtxt()
     *
     * The validity context
     */
    xmlValidCtxt vctxt;

    /* push parser state */
    xmlParserInputState instate XML_DEPRECATED_MEMBER;
    /* unused */
    int token XML_DEPRECATED_MEMBER;

    /**
     * @deprecated Don't use
     *
     * The main document URI, if available, with its last
     * component stripped.
     */
    char *directory;

    /* Node name stack */

    /* Current parsed Node */
    const xmlChar *name XML_DEPRECATED_MEMBER;
    /* Depth of the parsing stack */
    int nameNr XML_DEPRECATED_MEMBER;
    /* Max depth of the parsing stack */
    int nameMax XML_DEPRECATED_MEMBER;
    /* array of nodes */
    const xmlChar **nameTab XML_DEPRECATED_MEMBER;

    /* unused */
    long nbChars XML_DEPRECATED_MEMBER;
    /* used by progressive parsing lookup */
    long checkIndex XML_DEPRECATED_MEMBER;
    /**
     * @deprecated Use inverted xmlParserOption XML_PARSE_NOBLANKS
     *
     * ugly but ...
     */
    int keepBlanks XML_DEPRECATED_MEMBER;
    /**
     * @deprecated Use xmlCtxtIsStopped()
     *
     * SAX callbacks are disabled
     */
    int disableSAX XML_DEPRECATED_MEMBER;
    /**
     * @deprecated Use xmlCtxtIsInSubset
     *
     * Set if DTD content is parsed.
     *
     * - 0: not in DTD
     * - 1: in internal DTD subset
     * - 2: in external DTD subset
     */
    int inSubset;
    /**
     * @deprecated Use the `name` argument of the
     * `internalSubset` SAX callback or #xmlCtxtGetDocTypeDecl
     *
     * Name of the internal subset (root element type).
     */
    const xmlChar *intSubName;
    /**
     * @deprecated Use the `systemId` argument of the
     * `internalSubset` SAX callback or #xmlCtxtGetDocTypeDecl
     *
     * System identifier (URI) of external the subset.
     */
    xmlChar *extSubURI;
    /**
     * @deprecated Use the `publicId` argument of the
     * `internalSubset` SAX callback or #xmlCtxtGetDocTypeDecl
     *
     * This member is MISNAMED. It contains the *public* identifier
     * of the external subset.
     */
    xmlChar *extSubSystem;

    /* xml:space values */

    /* Should the parser preserve spaces */
    int *space XML_DEPRECATED_MEMBER;
    /* Depth of the parsing stack */
    int spaceNr XML_DEPRECATED_MEMBER;
    /* Max depth of the parsing stack */
    int spaceMax XML_DEPRECATED_MEMBER;
    /* array of space infos */
    int *spaceTab XML_DEPRECATED_MEMBER;

    /* to prevent entity substitution loops */
    int depth XML_DEPRECATED_MEMBER;
    /* unused */
    xmlParserInput *entity XML_DEPRECATED_MEMBER;
    /* unused */
    int charset XML_DEPRECATED_MEMBER;
    /* Those two fields are there to speed up large node parsing */
    int nodelen XML_DEPRECATED_MEMBER;
    int nodemem XML_DEPRECATED_MEMBER;
    /**
     * @deprecated Use xmlParserOption XML_PARSE_PEDANTIC
     *
     * signal pedantic warnings
     */
    int pedantic XML_DEPRECATED_MEMBER;
    /**
     * @deprecated Use xmlCtxtGetPrivate() and xmlCtxtSetPrivate()
     *
     * For user data, libxml won't touch it
     */
    void *_private;
    /**
     * @deprecated Use xmlParserOption XML_PARSE_DTDLOAD,
     * XML_PARSE_DTDATTR or XML_PARSE_SKIP_IDS.
     *
     * Control loading of the external subset and handling of IDs.
     * Other options like `validate` can override this value.
     *
     * - 0: The default behavior is to process IDs and to ignore
     *   the external subset.
     * - XML_DETECT_IDS: Load external subset. This flag is
     *   misnamed. ID handling is only controlled by XML_SKIP_IDS.
     * - XML_COMPLETE_ATTRS: Load external subset and process
     *   default attributes.
     * - XML_SKIP_IDS: Ignore IDs.
     */
    int loadsubset XML_DEPRECATED_MEMBER;
    /* unused */
    int linenumbers XML_DEPRECATED_MEMBER;
    /**
     * @deprecated Use xmlCtxtGetCatalogs() and xmlCtxtSetCatalogs()
     *
     * document's own catalog
     */
    void *catalogs XML_DEPRECATED_MEMBER;
    /**
     * @deprecated Use xmlParserOption XML_PARSE_RECOVER
     * run in recovery mode
     */
    int recovery XML_DEPRECATED_MEMBER;
    /* unused */
    int progressive XML_DEPRECATED_MEMBER;
    /**
     * @deprecated Use xmlCtxtGetDict() and xmlCtxtSetDict()
     *
     * dictionary for the parser
     */
    xmlDict *dict;
    /* array for the attributes callbacks */
    const xmlChar **atts XML_DEPRECATED_MEMBER;
    /* the size of the array */
    int maxatts XML_DEPRECATED_MEMBER;
    /* unused */
    int docdict XML_DEPRECATED_MEMBER;

    /*
     * pre-interned strings
     */
    const xmlChar *str_xml XML_DEPRECATED_MEMBER;
    const xmlChar *str_xmlns XML_DEPRECATED_MEMBER;
    const xmlChar *str_xml_ns XML_DEPRECATED_MEMBER;

    /*
     * Everything below is used only by the new SAX mode
     */

    /* operating in the new SAX mode */
    int sax2 XML_DEPRECATED_MEMBER;
    /* the number of inherited namespaces */
    int nsNr XML_DEPRECATED_MEMBER;
    /* the size of the arrays */
    int nsMax XML_DEPRECATED_MEMBER;
    /* the array of prefix/namespace name */
    const xmlChar **nsTab XML_DEPRECATED_MEMBER;
    /* which attribute were allocated */
    unsigned *attallocs XML_DEPRECATED_MEMBER;
    /* array of data for push */
    xmlStartTag *pushTab XML_DEPRECATED_MEMBER;
    /* defaulted attributes if any */
    xmlHashTable *attsDefault XML_DEPRECATED_MEMBER;
    /* non-CDATA attributes if any */
    xmlHashTable *attsSpecial XML_DEPRECATED_MEMBER;

    /**
     * @deprecated Use xmlCtxtGetStatus()
     *
     * is the document XML Namespace okay
     */
    int nsWellFormed;
    /**
     * @deprecated Use xmlCtxtGetOptions()
     *
     * Extra options
     */
    int options;

    /**
     * @deprecated Use inverted xmlParserOption XML_PARSE_NODICT
     *
     * Use dictionary names for the tree
     */
    int dictNames XML_DEPRECATED_MEMBER;

    /*
     * Those fields are needed only for streaming parsing so far
     */

    /* number of freed element nodes */
    int freeElemsNr XML_DEPRECATED_MEMBER;
    /* List of freed element nodes */
    xmlNode *freeElems XML_DEPRECATED_MEMBER;
    /* number of freed attributes nodes */
    int freeAttrsNr XML_DEPRECATED_MEMBER;
    /* List of freed attributes nodes */
    xmlAttr *freeAttrs XML_DEPRECATED_MEMBER;

    /**
     * @deprecated Use xmlCtxtGetLastError()
     *
     * the complete error information for the last error.
     */
    xmlError lastError XML_DEPRECATED_MEMBER;
    /* the parser mode */
    xmlParserMode parseMode XML_DEPRECATED_MEMBER;
    /* unused */
    unsigned long nbentities XML_DEPRECATED_MEMBER;
    /* size of external entities */
    unsigned long sizeentities XML_DEPRECATED_MEMBER;

    /* for use by HTML non-recursive parser */
    /* Current NodeInfo */
    xmlParserNodeInfo *nodeInfo XML_DEPRECATED_MEMBER;
    /* Depth of the parsing stack */
    int nodeInfoNr XML_DEPRECATED_MEMBER;
    /* Max depth of the parsing stack */
    int nodeInfoMax XML_DEPRECATED_MEMBER;
    /* array of nodeInfos */
    xmlParserNodeInfo *nodeInfoTab XML_DEPRECATED_MEMBER;

    /* we need to label inputs */
    int input_id XML_DEPRECATED_MEMBER;
    /* volume of entity copy */
    unsigned long sizeentcopy XML_DEPRECATED_MEMBER;

    /* quote state for push parser */
    int endCheckState XML_DEPRECATED_MEMBER;
    /* number of errors */
    unsigned short nbErrors XML_DEPRECATED_MEMBER;
    /* number of warnings */
    unsigned short nbWarnings XML_DEPRECATED_MEMBER;
    /* maximum amplification factor */
    unsigned maxAmpl XML_DEPRECATED_MEMBER;

    /* namespace database */
    xmlParserNsData *nsdb XML_DEPRECATED_MEMBER;
    /* allocated size */
    unsigned attrHashMax XML_DEPRECATED_MEMBER;
    /* atttribute hash table */
    xmlAttrHashBucket *attrHash XML_DEPRECATED_MEMBER;

    xmlStructuredErrorFunc errorHandler XML_DEPRECATED_MEMBER;
    void *errorCtxt XML_DEPRECATED_MEMBER;

    xmlResourceLoader resourceLoader XML_DEPRECATED_MEMBER;
    void *resourceCtxt XML_DEPRECATED_MEMBER;

    xmlCharEncConvImpl convImpl XML_DEPRECATED_MEMBER;
    void *convCtxt XML_DEPRECATED_MEMBER;
};

/**
 * A SAX Locator.
 */
struct _xmlSAXLocator {
    const xmlChar *(*getPublicId)(void *ctx);
    const xmlChar *(*getSystemId)(void *ctx);
    int (*getLineNumber)(void *ctx);
    int (*getColumnNumber)(void *ctx);
};

/**
 * SAX callback to resolve external entities.
 *
 * This is only used to load DTDs. The preferred way to install
 * custom resolvers is #xmlCtxtSetResourceLoader.
 *
 * @param ctx  the user data (XML parser context)
 * @param publicId  The public identifier of the entity
 * @param systemId  The system identifier of the entity (URL)
 * @returns the xmlParserInput if inlined or NULL for DOM behaviour.
 */
typedef xmlParserInput *(*resolveEntitySAXFunc) (void *ctx,
				const xmlChar *publicId,
				const xmlChar *systemId);
/**
 * SAX callback for the internal subset.
 *
 * @param ctx  the user data (XML parser context)
 * @param name  the root element name
 * @param publicId  the public identifier
 * @param systemId  the system identifier (e.g. filename or URL)
 */
typedef void (*internalSubsetSAXFunc) (void *ctx,
				const xmlChar *name,
				const xmlChar *publicId,
				const xmlChar *systemId);
/**
 * SAX callback for the external subset.
 *
 * @param ctx  the user data (XML parser context)
 * @param name  the root element name
 * @param publicId  the public identifier
 * @param systemId  the system identifier (e.g. filename or URL)
 */
typedef void (*externalSubsetSAXFunc) (void *ctx,
				const xmlChar *name,
				const xmlChar *publicId,
				const xmlChar *systemId);
/**
 * SAX callback to look up a general entity by name.
 *
 * @param ctx  the user data (XML parser context)
 * @param name  The entity name
 * @returns the xmlEntity if found.
 */
typedef xmlEntity *(*getEntitySAXFunc) (void *ctx,
				const xmlChar *name);
/**
 * SAX callback to look up a parameter entity by name.
 *
 * @param ctx  the user data (XML parser context)
 * @param name  The entity name
 * @returns the xmlEntity if found.
 */
typedef xmlEntity *(*getParameterEntitySAXFunc) (void *ctx,
				const xmlChar *name);
/**
 * SAX callback for entity declarations.
 *
 * @param ctx  the user data (XML parser context)
 * @param name  the entity name
 * @param type  the entity type
 * @param publicId  The public ID of the entity
 * @param systemId  The system ID of the entity
 * @param content  the entity value (without processing).
 */
typedef void (*entityDeclSAXFunc) (void *ctx,
				const xmlChar *name,
				int type,
				const xmlChar *publicId,
				const xmlChar *systemId,
				xmlChar *content);
/**
 * SAX callback for notation declarations.
 *
 * @param ctx  the user data (XML parser context)
 * @param name  The name of the notation
 * @param publicId  The public ID of the notation
 * @param systemId  The system ID of the notation
 */
typedef void (*notationDeclSAXFunc)(void *ctx,
				const xmlChar *name,
				const xmlChar *publicId,
				const xmlChar *systemId);
/**
 * SAX callback for attribute declarations.
 *
 * @param ctx  the user data (XML parser context)
 * @param elem  the name of the element
 * @param fullname  the attribute name
 * @param type  the attribute type
 * @param def  the type of default value
 * @param defaultValue  the attribute default value
 * @param tree  the tree of enumerated value set
 */
typedef void (*attributeDeclSAXFunc)(void *ctx,
				const xmlChar *elem,
				const xmlChar *fullname,
				int type,
				int def,
				const xmlChar *defaultValue,
				xmlEnumeration *tree);
/**
 * SAX callback for element declarations.
 *
 * @param ctx  the user data (XML parser context)
 * @param name  the element name
 * @param type  the element type
 * @param content  the element value tree
 */
typedef void (*elementDeclSAXFunc)(void *ctx,
				const xmlChar *name,
				int type,
				xmlElementContent *content);
/**
 * SAX callback for unparsed entity declarations.
 *
 * @param ctx  the user data (XML parser context)
 * @param name  The name of the entity
 * @param publicId  The public ID of the entity
 * @param systemId  The system ID of the entity
 * @param notationName  the name of the notation
 */
typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
				const xmlChar *name,
				const xmlChar *publicId,
				const xmlChar *systemId,
				const xmlChar *notationName);
/**
 * This callback receives the "document locator" at startup,
 * which is always the global xmlDefaultSAXLocator.
 *
 * Everything is available on the context, so this is useless in
 * our case.
 *
 * @param ctx  the user data (XML parser context)
 * @param loc  A SAX Locator
 */
typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
				xmlSAXLocator *loc);
/**
 * SAX callback for start of document.
 *
 * @param ctx  the user data (XML parser context)
 */
typedef void (*startDocumentSAXFunc) (void *ctx);
/**
 * SAX callback for end of document.
 *
 * @param ctx  the user data (XML parser context)
 */
typedef void (*endDocumentSAXFunc) (void *ctx);
/**
 * SAX callback for start tags.
 *
 * @param ctx  the user data (XML parser context)
 * @param name  The element name, including namespace prefix
 * @param atts  An array of name/value attributes pairs, NULL terminated
 */
typedef void (*startElementSAXFunc) (void *ctx,
				const xmlChar *name,
				const xmlChar **atts);
/**
 * SAX callback for end tags.
 *
 * @param ctx  the user data (XML parser context)
 * @param name  The element name
 */
typedef void (*endElementSAXFunc) (void *ctx,
				const xmlChar *name);
/**
 * Callback for attributes.
 *
 * @deprecated This typedef is unused.
 *
 * @param ctx  the user data (XML parser context)
 * @param name  The attribute name, including namespace prefix
 * @param value  The attribute value
 */
typedef void (*attributeSAXFunc) (void *ctx,
				const xmlChar *name,
				const xmlChar *value);
/**
 * SAX callback for entity references.
 *
 * @param ctx  the user data (XML parser context)
 * @param name  The entity name
 */
typedef void (*referenceSAXFunc) (void *ctx,
				const xmlChar *name);
/**
 * SAX callback for character data.
 *
 * @param ctx  the user data (XML parser context)
 * @param ch  a xmlChar string
 * @param len  the number of xmlChar
 */
typedef void (*charactersSAXFunc) (void *ctx,
				const xmlChar *ch,
				int len);
/**
 * SAX callback for "ignorable" whitespace.
 *
 * @param ctx  the user data (XML parser context)
 * @param ch  a xmlChar string
 * @param len  the number of xmlChar
 */
typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
				const xmlChar *ch,
				int len);
/**
 * SAX callback for processing instructions.
 *
 * @param ctx  the user data (XML parser context)
 * @param target  the target name
 * @param data  the PI data's
 */
typedef void (*processingInstructionSAXFunc) (void *ctx,
				const xmlChar *target,
				const xmlChar *data);
/**
 * SAX callback for comments.
 *
 * @param ctx  the user data (XML parser context)
 * @param value  the comment content
 */
typedef void (*commentSAXFunc) (void *ctx,
				const xmlChar *value);
/**
 * SAX callback for CDATA sections.
 *
 * @param ctx  the user data (XML parser context)
 * @param value  The pcdata content
 * @param len  the block length
 */
typedef void (*cdataBlockSAXFunc) (
	                        void *ctx,
				const xmlChar *value,
				int len);
/**
 * SAX callback for warning messages.
 *
 * @param ctx  an XML parser context
 * @param msg  the message to display/transmit
 * @param ...  extra parameters for the message display
 */
typedef void (*warningSAXFunc) (void *ctx,
				const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
 * SAX callback for error messages.
 *
 * @param ctx  an XML parser context
 * @param msg  the message to display/transmit
 * @param ...  extra parameters for the message display
 */
typedef void (*errorSAXFunc) (void *ctx,
				const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
 * SAX callback for fatal error messages.
 *
 * @param ctx  an XML parser context
 * @param msg  the message to display/transmit
 * @param ...  extra parameters for the message display
 */
typedef void (*fatalErrorSAXFunc) (void *ctx,
				const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
 * SAX callback to get standalone status.
 *
 * @param ctx  the user data (XML parser context)
 * @returns 1 if true
 */
typedef int (*isStandaloneSAXFunc) (void *ctx);
/**
 * SAX callback to get internal subset status.
 *
 * @param ctx  the user data (XML parser context)
 * @returns 1 if true
 */
typedef int (*hasInternalSubsetSAXFunc) (void *ctx);

/**
 * SAX callback to get external subset status.
 *
 * @param ctx  the user data (XML parser context)
 * @returns 1 if true
 */
typedef int (*hasExternalSubsetSAXFunc) (void *ctx);

/************************************************************************
 *									*
 *			The SAX version 2 API extensions		*
 *									*
 ************************************************************************/
/**
 * Special constant required for SAX2 handlers.
 */
#define XML_SAX2_MAGIC 0xDEEDBEAF

/**
 * SAX2 callback for start tags.
 *
 * It provides the namespace information for the element, as well as
 * the new namespace declarations on the element.
 *
 * @param ctx  the user data (XML parser context)
 * @param localname  the local name of the element
 * @param prefix  the element namespace prefix if available
 * @param URI  the element namespace name if available
 * @param nb_namespaces  number of namespace definitions on that node
 * @param namespaces  pointer to the array of prefix/URI pairs namespace definitions
 * @param nb_attributes  the number of attributes on that node
 * @param nb_defaulted  the number of defaulted attributes. The defaulted
 *                  ones are at the end of the array
 * @param attributes  pointer to the array of (localname/prefix/URI/value/end)
 *               attribute values.
 */

typedef void (*startElementNsSAX2Func) (void *ctx,
					const xmlChar *localname,
					const xmlChar *prefix,
					const xmlChar *URI,
					int nb_namespaces,
					const xmlChar **namespaces,
					int nb_attributes,
					int nb_defaulted,
					const xmlChar **attributes);

/**
 * SAX2 callback for end tags.
 *
 * It provides the namespace information for the element.
 *
 * @param ctx  the user data (XML parser context)
 * @param localname  the local name of the element
 * @param prefix  the element namespace prefix if available
 * @param URI  the element namespace name if available
 */

typedef void (*endElementNsSAX2Func)   (void *ctx,
					const xmlChar *localname,
					const xmlChar *prefix,
					const xmlChar *URI);

/**
 * Callbacks for SAX parser
 *
 * For DTD-related handlers, it's recommended to either use the
 * original libxml2 handler or set them to NULL if DTDs can be
 * ignored.
 */
struct _xmlSAXHandler {
    /**
     * Called after the start of the document type declaration
     * was parsed.
     *
     * Should typically not be modified.
     */
    internalSubsetSAXFunc internalSubset;
    /**
     * Standalone status. Not invoked by the parser. Not supposed
     * to be changed by applications.
     */
    isStandaloneSAXFunc isStandalone;
    /**
     * Internal subset availability. Not invoked by the parser.
     * Not supposed to be changed by applications.
     */
    hasInternalSubsetSAXFunc hasInternalSubset;
    /**
     * External subset availability. Not invoked by the parser.
     * Not supposed to be changed by applications.
     */
    hasExternalSubsetSAXFunc hasExternalSubset;
    /**
     * Only called when loading external DTDs. Not called to load
     * external entities.
     *
     * Should typically not be modified.
     */
    resolveEntitySAXFunc resolveEntity;
    /**
     * Called when looking up general entities.
     *
     * Should typically not be modified.
     */
    getEntitySAXFunc getEntity;
    /**
     * Called after an entity declaration was parsed.
     *
     * Should typically not be modified.
     */
    entityDeclSAXFunc entityDecl;
    /**
     * Called after a notation declaration was parsed.
     *
     * Should typically not be modified.
     */
    notationDeclSAXFunc notationDecl;
    /**
     * Called after an attribute declaration was parsed.
     *
     * Should typically not be modified.
     */
    attributeDeclSAXFunc attributeDecl;
    /**
     * Called after an element declaration was parsed.
     *
     * Should typically not be modified.
     */
    elementDeclSAXFunc elementDecl;
    /**
     * Called after an unparsed entity declaration was parsed.
     *
     * Should typically not be modified.
     */
    unparsedEntityDeclSAXFunc unparsedEntityDecl;
    /**
     * This callback receives the "document locator" at startup,
     * which is always the global xmlDefaultSAXLocator.
     *
     * Everything is available on the context, so this is useless in
     * our case.
     */
    setDocumentLocatorSAXFunc setDocumentLocator;
    /**
     * Called after the XML declaration was parsed.
     *
     * Use xmlCtxtGetVersion(), xmlCtxtGetDeclaredEncoding() and
     * xmlCtxtGetStandalone() to get data from the XML declaration.
     */
    startDocumentSAXFunc startDocument;
    /**
     * Called at the end of the document.
     */
    endDocumentSAXFunc endDocument;
    /**
     * Legacy start tag handler
     *
     * `startElement` and `endElement` are only used by the legacy SAX1
     * interface and should not be used in new software. If you really
     * have to enable SAX1, the preferred way is set the `initialized`
     * member to 1 instead of XML_SAX2_MAGIC.
     *
     * For backward compatibility, it's also possible to set the
     * `startElementNs` and `endElementNs` handlers to NULL.
     *
     * You can also set the XML_PARSE_SAX1 parser option, but versions
     * older than 2.12.0 will probably crash if this option is provided
     * together with custom SAX callbacks.
     */
    startElementSAXFunc startElement;
    /**
     * See _xmlSAXHandler.startElement
     */
    endElementSAXFunc endElement;
    /**
     * Called after an entity reference was parsed.
     */
    referenceSAXFunc reference;
    /**
     * Called after a character data was parsed.
     */
    charactersSAXFunc characters;
    /**
     * Called after "ignorable" whitespace was parsed.
     *
     * `ignorableWhitespace` should always be set to the same value
     * as `characters`. Otherwise, the parser will try to detect
     * whitespace which is unreliable.
     */
    ignorableWhitespaceSAXFunc ignorableWhitespace;
    /**
     * Called after a processing instruction was parsed.
     */
    processingInstructionSAXFunc processingInstruction;
    /**
     * Called after a comment was parsed.
     */
    commentSAXFunc comment;
    /**
     * Callback for warning messages.
     */
    warningSAXFunc warning;
    /**
     * Callback for error messages.
     */
    errorSAXFunc error;
    /**
     * Unused, all errors go to `error`.
     */
    fatalErrorSAXFunc fatalError;
    /**
     * Called when looking up parameter entities.
     *
     * Should typically not be modified.
     */
    getParameterEntitySAXFunc getParameterEntity;
    /**
     * Called after a CDATA section was parsed.
     */
    cdataBlockSAXFunc cdataBlock;
    /**
     * Called to parse the external subset.
     *
     * Should typically not be modified.
     */
    externalSubsetSAXFunc externalSubset;
    /**
     * Legacy magic value
     *
     * `initialized` should always be set to XML_SAX2_MAGIC to
     * enable the modern SAX2 interface.
     */
    unsigned int initialized;
    /**
     * Application data
     */
    void *_private;
    /**
     * Called after a start tag was parsed.
     */
    startElementNsSAX2Func startElementNs;
    /**
     * Called after an end tag was parsed.
     */
    endElementNsSAX2Func endElementNs;
    /**
     * Structured error handler.
     *
     * Takes precedence over `error` or `warning`, but modern code
     * should use xmlCtxtSetErrorHandler().
     */
    xmlStructuredErrorFunc serror;
};

/**
 * SAX handler, version 1.
 *
 * @deprecated Use version 2 handlers.
 */
typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1;
typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr;
/**
 * SAX handler, version 1.
 *
 * @deprecated Use version 2 handlers.
 */
struct _xmlSAXHandlerV1 {
    internalSubsetSAXFunc internalSubset;
    isStandaloneSAXFunc isStandalone;
    hasInternalSubsetSAXFunc hasInternalSubset;
    hasExternalSubsetSAXFunc hasExternalSubset;
    resolveEntitySAXFunc resolveEntity;
    getEntitySAXFunc getEntity;
    entityDeclSAXFunc entityDecl;
    notationDeclSAXFunc notationDecl;
    attributeDeclSAXFunc attributeDecl;
    elementDeclSAXFunc elementDecl;
    unparsedEntityDeclSAXFunc unparsedEntityDecl;
    setDocumentLocatorSAXFunc setDocumentLocator;
    startDocumentSAXFunc startDocument;
    endDocumentSAXFunc endDocument;
    startElementSAXFunc startElement;
    endElementSAXFunc endElement;
    referenceSAXFunc reference;
    charactersSAXFunc characters;
    ignorableWhitespaceSAXFunc ignorableWhitespace;
    processingInstructionSAXFunc processingInstruction;
    commentSAXFunc comment;
    warningSAXFunc warning;
    errorSAXFunc error;
    fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
    getParameterEntitySAXFunc getParameterEntity;
    cdataBlockSAXFunc cdataBlock;
    externalSubsetSAXFunc externalSubset;
    unsigned int initialized;
};


/**
 * Callback for external entity loader.
 *
 * The URL is not resolved using XML catalogs before being passed
 * to the callback.
 *
 * @param URL  The URL or system ID of the resource requested
 * @param publicId  The public ID of the resource requested (optional)
 * @param context  the XML parser context
 * @returns the entity input parser or NULL on error.
 */
typedef xmlParserInput *(*xmlExternalEntityLoader) (const char *URL,
					 const char *publicId,
					 xmlParserCtxt *context);

/*
 * Variables
 */

XMLPUBVAR const char *const xmlParserVersion;

/** @cond ignore */

XML_DEPRECATED
XMLPUBVAR const xmlSAXLocator xmlDefaultSAXLocator;
#ifdef LIBXML_SAX1_ENABLED
/**
 * @deprecated Use #xmlSAXVersion or #xmlSAX2InitDefaultSAXHandler
 */
XML_DEPRECATED
XMLPUBVAR const xmlSAXHandlerV1 xmlDefaultSAXHandler;
#endif

XML_DEPRECATED
XMLPUBFUN int *__xmlDoValidityCheckingDefaultValue(void);
XML_DEPRECATED
XMLPUBFUN int *__xmlGetWarningsDefaultValue(void);
XML_DEPRECATED
XMLPUBFUN int *__xmlKeepBlanksDefaultValue(void);
XML_DEPRECATED
XMLPUBFUN int *__xmlLineNumbersDefaultValue(void);
XML_DEPRECATED
XMLPUBFUN int *__xmlLoadExtDtdDefaultValue(void);
XML_DEPRECATED
XMLPUBFUN int *__xmlPedanticParserDefaultValue(void);
XML_DEPRECATED
XMLPUBFUN int *__xmlSubstituteEntitiesDefaultValue(void);

#ifdef LIBXML_OUTPUT_ENABLED
XML_DEPRECATED
XMLPUBFUN int *__xmlIndentTreeOutput(void);
XML_DEPRECATED
XMLPUBFUN const char **__xmlTreeIndentString(void);
XML_DEPRECATED
XMLPUBFUN int *__xmlSaveNoEmptyTags(void);
#endif

/** @endcond */

#ifndef XML_GLOBALS_NO_REDEFINITION
  /**
   * Thread-local setting to enable validation. Defaults to 0.
   *
   * @deprecated Use the parser option XML_PARSE_DTDVALID.
   */
  #define xmlDoValidityCheckingDefaultValue \
    (*__xmlDoValidityCheckingDefaultValue())
  /**
   * Thread-local setting to disable warnings. Defaults to 1.
   *
   * @deprecated Use the parser option XML_PARSE_NOWARNING.
   */
  #define xmlGetWarningsDefaultValue \
    (*__xmlGetWarningsDefaultValue())
  /**
   * Thread-local setting to ignore some whitespace. Defaults
   * to 1.
   *
   * @deprecated Use the parser option XML_PARSE_NOBLANKS.
   */
  #define xmlKeepBlanksDefaultValue (*__xmlKeepBlanksDefaultValue())
  /**
   * Thread-local setting to store line numbers. Defaults
   * to 0, but is always enabled after setting parser options.
   *
   * @deprecated Shouldn't be needed when using parser options.
   */
  #define xmlLineNumbersDefaultValue \
    (*__xmlLineNumbersDefaultValue())
  /**
   * Thread-local setting to enable loading of external DTDs.
   * Defaults to 0.
   *
   * @deprecated Use the parser option XML_PARSE_DTDLOAD.
   */
  #define xmlLoadExtDtdDefaultValue (*__xmlLoadExtDtdDefaultValue())
  /**
   * Thread-local setting to enable pedantic warnings.
   * Defaults to 0.
   *
   * @deprecated Use the parser option XML_PARSE_PEDANTIC.
   */
  #define xmlPedanticParserDefaultValue \
    (*__xmlPedanticParserDefaultValue())
  /**
   * Thread-local setting to enable entity substitution.
   * Defaults to 0.
   *
   * @deprecated Use the parser option XML_PARSE_NOENT.
   */
  #define xmlSubstituteEntitiesDefaultValue \
    (*__xmlSubstituteEntitiesDefaultValue())
  #ifdef LIBXML_OUTPUT_ENABLED
    /**
     * Thread-local setting to disable indenting when
     * formatting output. Defaults to 1.
     *
     * @deprecated Use the xmlsave.h API with option
     * XML_SAVE_NO_INDENT.
     */
    #define xmlIndentTreeOutput (*__xmlIndentTreeOutput())
    /**
     * Thread-local setting to change the indent string.
     * Defaults to two spaces.
     *
     * @deprecated Use the xmlsave.h API and
     * xmlSaveSetIndentString().
     */
    #define xmlTreeIndentString (*__xmlTreeIndentString())
    /**
     * Thread-local setting to disable empty tags when
     * serializing. Defaults to 0.
     *
     * @deprecated Use the xmlsave.h API with option
     * XML_SAVE_NO_EMPTY.
     */
    #define xmlSaveNoEmptyTags (*__xmlSaveNoEmptyTags())
  #endif
#endif

/*
 * Init/Cleanup
 */
XMLPUBFUN void
		xmlInitParser		(void);
XMLPUBFUN void
		xmlCleanupParser	(void);
XML_DEPRECATED
XMLPUBFUN void
		xmlInitGlobals		(void);
XML_DEPRECATED
XMLPUBFUN void
		xmlCleanupGlobals	(void);

/*
 * Input functions
 */
XML_DEPRECATED
XMLPUBFUN int
		xmlParserInputRead	(xmlParserInput *in,
					 int len);
XMLPUBFUN int
		xmlParserInputGrow	(xmlParserInput *in,
					 int len);

/*
 * Basic parsing Interfaces
 */
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN xmlDoc *
		xmlParseDoc		(const xmlChar *cur);
XMLPUBFUN xmlDoc *
		xmlParseFile		(const char *filename);
XMLPUBFUN xmlDoc *
		xmlParseMemory		(const char *buffer,
					 int size);
#endif /* LIBXML_SAX1_ENABLED */
XML_DEPRECATED
XMLPUBFUN int
		xmlSubstituteEntitiesDefault(int val);
XMLPUBFUN int
		xmlKeepBlanksDefault	(int val);
XMLPUBFUN void
		xmlStopParser		(xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN int
		xmlPedanticParserDefault(int val);
XML_DEPRECATED
XMLPUBFUN int
		xmlLineNumbersDefault	(int val);

XML_DEPRECATED
XMLPUBFUN int
                xmlThrDefSubstituteEntitiesDefaultValue(int v);
XML_DEPRECATED
XMLPUBFUN int
		xmlThrDefKeepBlanksDefaultValue(int v);
XML_DEPRECATED
XMLPUBFUN int
                xmlThrDefPedanticParserDefaultValue(int v);
XML_DEPRECATED
XMLPUBFUN int
                xmlThrDefLineNumbersDefaultValue(int v);
XML_DEPRECATED
XMLPUBFUN int
                xmlThrDefDoValidityCheckingDefaultValue(int v);
XML_DEPRECATED
XMLPUBFUN int
                xmlThrDefGetWarningsDefaultValue(int v);
XML_DEPRECATED
XMLPUBFUN int
                xmlThrDefLoadExtDtdDefaultValue(int v);

#ifdef LIBXML_SAX1_ENABLED
/*
 * Recovery mode
 */
XML_DEPRECATED
XMLPUBFUN xmlDoc *
		xmlRecoverDoc		(const xmlChar *cur);
XML_DEPRECATED
XMLPUBFUN xmlDoc *
		xmlRecoverMemory	(const char *buffer,
					 int size);
XML_DEPRECATED
XMLPUBFUN xmlDoc *
		xmlRecoverFile		(const char *filename);
#endif /* LIBXML_SAX1_ENABLED */

/*
 * Less common routines and SAX interfaces
 */
XMLPUBFUN int
		xmlParseDocument	(xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN int
		xmlParseExtParsedEnt	(xmlParserCtxt *ctxt);
#ifdef LIBXML_SAX1_ENABLED
XML_DEPRECATED
XMLPUBFUN int
		xmlSAXUserParseFile	(xmlSAXHandler *sax,
					 void *user_data,
					 const char *filename);
XML_DEPRECATED
XMLPUBFUN int
		xmlSAXUserParseMemory	(xmlSAXHandler *sax,
					 void *user_data,
					 const char *buffer,
					 int size);
XML_DEPRECATED
XMLPUBFUN xmlDoc *
		xmlSAXParseDoc		(xmlSAXHandler *sax,
					 const xmlChar *cur,
					 int recovery);
XML_DEPRECATED
XMLPUBFUN xmlDoc *
		xmlSAXParseMemory	(xmlSAXHandler *sax,
					 const char *buffer,
					 int size,
					 int recovery);
XML_DEPRECATED
XMLPUBFUN xmlDoc *
		xmlSAXParseMemoryWithData (xmlSAXHandler *sax,
					 const char *buffer,
					 int size,
					 int recovery,
					 void *data);
XML_DEPRECATED
XMLPUBFUN xmlDoc *
		xmlSAXParseFile		(xmlSAXHandler *sax,
					 const char *filename,
					 int recovery);
XML_DEPRECATED
XMLPUBFUN xmlDoc *
		xmlSAXParseFileWithData	(xmlSAXHandler *sax,
					 const char *filename,
					 int recovery,
					 void *data);
XML_DEPRECATED
XMLPUBFUN xmlDoc *
		xmlSAXParseEntity	(xmlSAXHandler *sax,
					 const char *filename);
XML_DEPRECATED
XMLPUBFUN xmlDoc *
		xmlParseEntity		(const char *filename);
#endif /* LIBXML_SAX1_ENABLED */

#ifdef LIBXML_VALID_ENABLED
XMLPUBFUN xmlDtd *
		xmlCtxtParseDtd		(xmlParserCtxt *ctxt,
					 xmlParserInput *input,
					 const xmlChar *publicId,
					 const xmlChar *systemId);
XMLPUBFUN int
		xmlCtxtValidateDocument	(xmlParserCtxt *ctxt,
					 xmlDoc *doc);
XMLPUBFUN int
		xmlCtxtValidateDtd	(xmlParserCtxt *ctxt,
					 xmlDoc *doc,
					 xmlDtd *dtd);
XML_DEPRECATED
XMLPUBFUN xmlDtd *
		xmlSAXParseDTD		(xmlSAXHandler *sax,
					 const xmlChar *publicId,
					 const xmlChar *systemId);
XMLPUBFUN xmlDtd *
		xmlParseDTD		(const xmlChar *publicId,
					 const xmlChar *systemId);
XMLPUBFUN xmlDtd *
		xmlIOParseDTD		(xmlSAXHandler *sax,
					 xmlParserInputBuffer *input,
					 xmlCharEncoding enc);
#endif /* LIBXML_VALID_ENABLE */
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN int
		xmlParseBalancedChunkMemory(xmlDoc *doc,
					 xmlSAXHandler *sax,
					 void *user_data,
					 int depth,
					 const xmlChar *string,
					 xmlNode **lst);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN xmlParserErrors
		xmlParseInNodeContext	(xmlNode *node,
					 const char *data,
					 int datalen,
					 int options,
					 xmlNode **lst);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN int
		xmlParseBalancedChunkMemoryRecover(xmlDoc *doc,
                     xmlSAXHandler *sax,
                     void *user_data,
                     int depth,
                     const xmlChar *string,
                     xmlNode **lst,
                     int recover);
XML_DEPRECATED
XMLPUBFUN int
		xmlParseExternalEntity	(xmlDoc *doc,
					 xmlSAXHandler *sax,
					 void *user_data,
					 int depth,
					 const xmlChar *URL,
					 const xmlChar *ID,
					 xmlNode **lst);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN int
		xmlParseCtxtExternalEntity(xmlParserCtxt *ctx,
					 const xmlChar *URL,
					 const xmlChar *ID,
					 xmlNode **lst);

/*
 * Parser contexts handling.
 */
XMLPUBFUN xmlParserCtxt *
		xmlNewParserCtxt	(void);
XMLPUBFUN xmlParserCtxt *
		xmlNewSAXParserCtxt	(const xmlSAXHandler *sax,
					 void *userData);
XMLPUBFUN int
		xmlInitParserCtxt	(xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
		xmlClearParserCtxt	(xmlParserCtxt *ctxt);
XMLPUBFUN void
		xmlFreeParserCtxt	(xmlParserCtxt *ctxt);
#ifdef LIBXML_SAX1_ENABLED
XML_DEPRECATED
XMLPUBFUN void
		xmlSetupParserForBuffer	(xmlParserCtxt *ctxt,
					 const xmlChar* buffer,
					 const char *filename);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN xmlParserCtxt *
		xmlCreateDocParserCtxt	(const xmlChar *cur);

#ifdef LIBXML_PUSH_ENABLED
/*
 * Interfaces for the Push mode.
 */
XMLPUBFUN xmlParserCtxt *
		xmlCreatePushParserCtxt(xmlSAXHandler *sax,
					 void *user_data,
					 const char *chunk,
					 int size,
					 const char *filename);
XMLPUBFUN int
		xmlParseChunk		(xmlParserCtxt *ctxt,
					 const char *chunk,
					 int size,
					 int terminate);
#endif /* LIBXML_PUSH_ENABLED */

/*
 * Special I/O mode.
 */

XMLPUBFUN xmlParserCtxt *
		xmlCreateIOParserCtxt	(xmlSAXHandler *sax,
					 void *user_data,
					 xmlInputReadCallback   ioread,
					 xmlInputCloseCallback  ioclose,
					 void *ioctx,
					 xmlCharEncoding enc);

XMLPUBFUN xmlParserInput *
		xmlNewIOInputStream	(xmlParserCtxt *ctxt,
					 xmlParserInputBuffer *input,
					 xmlCharEncoding enc);

/*
 * Node infos.
 */
XML_DEPRECATED
XMLPUBFUN const xmlParserNodeInfo*
		xmlParserFindNodeInfo	(xmlParserCtxt *ctxt,
				         xmlNode *node);
XML_DEPRECATED
XMLPUBFUN void
		xmlInitNodeInfoSeq	(xmlParserNodeInfoSeq *seq);
XML_DEPRECATED
XMLPUBFUN void
		xmlClearNodeInfoSeq	(xmlParserNodeInfoSeq *seq);
XML_DEPRECATED
XMLPUBFUN unsigned long
		xmlParserFindNodeInfoIndex(xmlParserNodeInfoSeq *seq,
                                         xmlNode *node);
XML_DEPRECATED
XMLPUBFUN void
		xmlParserAddNodeInfo	(xmlParserCtxt *ctxt,
					 xmlParserNodeInfo *info);

/*
 * External entities handling actually implemented in xmlIO.
 */

XMLPUBFUN void
		xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
XMLPUBFUN xmlExternalEntityLoader
		xmlGetExternalEntityLoader(void);
XMLPUBFUN xmlParserInput *
		xmlLoadExternalEntity	(const char *URL,
					 const char *ID,
					 xmlParserCtxt *ctxt);

XML_DEPRECATED
XMLPUBFUN long
		xmlByteConsumed		(xmlParserCtxt *ctxt);

/*
 * New set of simpler/more flexible APIs
 */

/**
 * This is the set of XML parser options that can be passed to
 * #xmlReadDoc, #xmlCtxtSetOptions and other functions.
 */
typedef enum {
    /**
     * Enable "recovery" mode which allows non-wellformed documents.
     * How this mode behaves exactly is unspecified and may change
     * without further notice. Use of this feature is DISCOURAGED.
     *
     * Not supported by the push parser.
     */
    XML_PARSE_RECOVER = 1<<0,
    /**
     * Despite the confusing name, this option enables substitution
     * of entities. The resulting tree won't contain any entity
     * reference nodes.
     *
     * This option also enables loading of external entities (both
     * general and parameter entities) which is dangerous. If you
     * process untrusted data, it's recommended to set the
     * XML_PARSE_NO_XXE option to disable loading of external
     * entities.
     */
    XML_PARSE_NOENT = 1<<1,
    /**
     * Enables loading of an external DTD and the loading and
     * substitution of external parameter entities. Has no effect
     * if XML_PARSE_NO_XXE is set.
     */
    XML_PARSE_DTDLOAD = 1<<2,
    /**
     * Adds default attributes from the DTD to the result document.
     *
     * Implies XML_PARSE_DTDLOAD, but loading of external content
     * can be disabled with XML_PARSE_NO_XXE.
     */
    XML_PARSE_DTDATTR = 1<<3,
    /**
     * This option enables DTD validation which requires to load
     * external DTDs and external entities (both general and
     * parameter entities) unless XML_PARSE_NO_XXE was set.
     *
     * DTD validation is vulnerable to algorithmic complexity
     * attacks and should never be enabled with untrusted input.
     */
    XML_PARSE_DTDVALID = 1<<4,
    /**
     * Disable error and warning reports to the error handlers.
     * Errors are still accessible with xmlCtxtGetLastError().
     */
    XML_PARSE_NOERROR = 1<<5,
    /**
     * Disable warning reports.
     */
    XML_PARSE_NOWARNING = 1<<6,
    /**
     * Enable some pedantic warnings.
     */
    XML_PARSE_PEDANTIC = 1<<7,
    /**
     * Remove some whitespace from the result document. Where to
     * remove whitespace depends on DTD element declarations or a
     * broken heuristic with unfixable bugs. Use of this option is
     * DISCOURAGED.
     *
     * Not supported by the push parser.
     */
    XML_PARSE_NOBLANKS = 1<<8,
    /**
     * Always invoke the deprecated SAX1 startElement and endElement
     * handlers.
     *
     * @deprecated This option will be removed in a future version.
     */
    XML_PARSE_SAX1 = 1<<9,
    /**
     * Enable XInclude processing. This option only affects the
     * xmlTextReader and XInclude interfaces.
     */
    XML_PARSE_XINCLUDE = 1<<10,
    /**
     * Disable network access with the built-in HTTP or FTP clients.
     *
     * After the last built-in network client was removed in 2.15,
     * this option has no effect expect for being passed on to custom
     * resource loaders.
     */
    XML_PARSE_NONET = 1<<11,
    /**
     * Create a document without interned strings, making all
     * strings separate memory allocations.
     */
    XML_PARSE_NODICT = 1<<12,
    /**
     * Remove redundant namespace declarations from the result
     * document.
     */
    XML_PARSE_NSCLEAN = 1<<13,
    /**
     * Output normal text nodes instead of CDATA nodes.
     */
    XML_PARSE_NOCDATA = 1<<14,
    /**
     * Don't generate XInclude start/end nodes when expanding
     * inclusions. This option only affects the xmlTextReader
     * and XInclude interfaces.
     */
    XML_PARSE_NOXINCNODE = 1<<15,
    /**
     * Store small strings directly in the node struct to save
     * memory.
     */
    XML_PARSE_COMPACT = 1<<16,
    /**
     * Use old Name productions from before XML 1.0 Fifth Edition.
     *
     * @deprecated This option will be removed in a future version.
     */
    XML_PARSE_OLD10 = 1<<17,
    /**
     * Don't fix up XInclude xml:base URIs. This option only affects
     * the xmlTextReader and XInclude interfaces.
     */
    XML_PARSE_NOBASEFIX = 1<<18,
    /**
     * Relax some internal limits.
     *
     * Maximum size of text nodes, tags, comments, processing instructions,
     * CDATA sections, entity values
     *
     * normal: 10M
     * huge:    1B
     *
     * Maximum size of names, system literals, pubid literals
     *
     * normal: 50K
     * huge:   10M
     *
     * Maximum nesting depth of elements
     *
     * normal:  256
     * huge:   2048
     *
     * Maximum nesting depth of entities
     *
     * normal: 20
     * huge:   40
     */
    XML_PARSE_HUGE = 1<<19,
    /**
     * Enable an unspecified legacy mode for SAX parsers.
     *
     * @deprecated This option will be removed in a future version.
     */
    XML_PARSE_OLDSAX = 1<<20,
    /**
     * Ignore the encoding in the XML declaration. This option is
     * mostly unneeded these days. The only effect is to enforce
     * UTF-8 decoding of ASCII-like data.
     */
    XML_PARSE_IGNORE_ENC = 1<<21,
    /**
     * Enable reporting of line numbers larger than 65535.
     */
    XML_PARSE_BIG_LINES = 1<<22,
    /**
     * Disables loading of external DTDs or entities.
     *
     * @since 2.13.0
     */
    XML_PARSE_NO_XXE = 1<<23,
    /**
     * Enable input decompression. Setting this option is discouraged
     * to avoid zip bombs.
     *
     * @since 2.14.0
     */
    XML_PARSE_UNZIP = 1<<24,
    /**
     * Disables the global system XML catalog.
     *
     * @since 2.14.0
     */
    XML_PARSE_NO_SYS_CATALOG = 1<<25,
    /**
     * Enable XML catalog processing instructions.
     *
     * @since 2.14.0
     */
    XML_PARSE_CATALOG_PI = 1<<26,
    /**
     * Force the parser to ignore IDs.
     *
     * @since 2.15.0
     */
    XML_PARSE_SKIP_IDS = 1<<27
} xmlParserOption;

XMLPUBFUN void
		xmlCtxtReset		(xmlParserCtxt *ctxt);
XMLPUBFUN int
		xmlCtxtResetPush	(xmlParserCtxt *ctxt,
					 const char *chunk,
					 int size,
					 const char *filename,
					 const char *encoding);
XMLPUBFUN int
		xmlCtxtGetOptions	(xmlParserCtxt *ctxt);
XMLPUBFUN int
		xmlCtxtSetOptions	(xmlParserCtxt *ctxt,
					 int options);
XMLPUBFUN int
		xmlCtxtUseOptions	(xmlParserCtxt *ctxt,
					 int options);
XMLPUBFUN void *
		xmlCtxtGetPrivate	(xmlParserCtxt *ctxt);
XMLPUBFUN void
		xmlCtxtSetPrivate	(xmlParserCtxt *ctxt,
					 void *priv);
XMLPUBFUN void *
		xmlCtxtGetCatalogs	(xmlParserCtxt *ctxt);
XMLPUBFUN void
		xmlCtxtSetCatalogs	(xmlParserCtxt *ctxt,
					 void *catalogs);
XMLPUBFUN xmlDict *
		xmlCtxtGetDict		(xmlParserCtxt *ctxt);
XMLPUBFUN void
		xmlCtxtSetDict		(xmlParserCtxt *ctxt,
					 xmlDict *);
XMLPUBFUN xmlSAXHandler *
		xmlCtxtGetSaxHandler	(xmlParserCtxt *ctxt);
XMLPUBFUN int
		xmlCtxtSetSaxHandler	(xmlParserCtxt *ctxt,
					 const xmlSAXHandler *sax);
XMLPUBFUN xmlDoc *
		xmlCtxtGetDocument	(xmlParserCtxt *ctxt);
XMLPUBFUN int
		xmlCtxtIsHtml		(xmlParserCtxt *ctxt);
XMLPUBFUN int
		xmlCtxtIsStopped	(xmlParserCtxt *ctxt);
XMLPUBFUN int
		xmlCtxtIsInSubset	(xmlParserCtxt *ctxt);
#ifdef LIBXML_VALID_ENABLED
XMLPUBFUN xmlValidCtxt *
		xmlCtxtGetValidCtxt	(xmlParserCtxt *ctxt);
#endif
XMLPUBFUN const xmlChar *
		xmlCtxtGetVersion	(xmlParserCtxt *ctxt);
XMLPUBFUN const xmlChar *
		xmlCtxtGetDeclaredEncoding(xmlParserCtxt *ctxt);
XMLPUBFUN int
		xmlCtxtGetStandalone	(xmlParserCtxt *ctxt);
XMLPUBFUN xmlParserStatus
		xmlCtxtGetStatus	(xmlParserCtxt *ctxt);
XMLPUBFUN void *
		xmlCtxtGetUserData	(xmlParserCtxt *ctxt);
XMLPUBFUN xmlNode *
		xmlCtxtGetNode		(xmlParserCtxt *ctxt);
XMLPUBFUN int
		xmlCtxtGetDocTypeDecl	(xmlParserCtxt *ctxt,
					 const xmlChar **name,
					 const xmlChar **systemId,
					 const xmlChar **publicId);
XMLPUBFUN int
		xmlCtxtGetInputPosition	(xmlParserCtxt *ctxt,
					 int inputIndex,
					 const char **filname,
					 int *line,
					 int *col,
					 unsigned long *bytePos);
XMLPUBFUN int
		xmlCtxtGetInputWindow	(xmlParserCtxt *ctxt,
					 int inputIndex,
					 const xmlChar **startOut,
					 int *sizeInOut,
					 int *offsetOut);
XMLPUBFUN void
		xmlCtxtSetErrorHandler	(xmlParserCtxt *ctxt,
					 xmlStructuredErrorFunc handler,
					 void *data);
XMLPUBFUN void
		xmlCtxtSetResourceLoader(xmlParserCtxt *ctxt,
					 xmlResourceLoader loader,
					 void *vctxt);
XMLPUBFUN void
		xmlCtxtSetCharEncConvImpl(xmlParserCtxt *ctxt,
					 xmlCharEncConvImpl impl,
					 void *vctxt);
XMLPUBFUN void
		xmlCtxtSetMaxAmplification(xmlParserCtxt *ctxt,
					 unsigned maxAmpl);
XMLPUBFUN xmlDoc *
		xmlReadDoc		(const xmlChar *cur,
					 const char *URL,
					 const char *encoding,
					 int options);
XMLPUBFUN xmlDoc *
		xmlReadFile		(const char *URL,
					 const char *encoding,
					 int options);
XMLPUBFUN xmlDoc *
		xmlReadMemory		(const char *buffer,
					 int size,
					 const char *URL,
					 const char *encoding,
					 int options);
XMLPUBFUN xmlDoc *
		xmlReadFd		(int fd,
					 const char *URL,
					 const char *encoding,
					 int options);
XMLPUBFUN xmlDoc *
		xmlReadIO		(xmlInputReadCallback ioread,
					 xmlInputCloseCallback ioclose,
					 void *ioctx,
					 const char *URL,
					 const char *encoding,
					 int options);
XMLPUBFUN xmlDoc *
		xmlCtxtParseDocument	(xmlParserCtxt *ctxt,
					 xmlParserInput *input);
XMLPUBFUN xmlNode *
		xmlCtxtParseContent	(xmlParserCtxt *ctxt,
					 xmlParserInput *input,
					 xmlNode *node,
					 int hasTextDecl);
XMLPUBFUN xmlDoc *
		xmlCtxtReadDoc		(xmlParserCtxt *ctxt,
					 const xmlChar *cur,
					 const char *URL,
					 const char *encoding,
					 int options);
XMLPUBFUN xmlDoc *
		xmlCtxtReadFile		(xmlParserCtxt *ctxt,
					 const char *filename,
					 const char *encoding,
					 int options);
XMLPUBFUN xmlDoc *
		xmlCtxtReadMemory		(xmlParserCtxt *ctxt,
					 const char *buffer,
					 int size,
					 const char *URL,
					 const char *encoding,
					 int options);
XMLPUBFUN xmlDoc *
		xmlCtxtReadFd		(xmlParserCtxt *ctxt,
					 int fd,
					 const char *URL,
					 const char *encoding,
					 int options);
XMLPUBFUN xmlDoc *
		xmlCtxtReadIO		(xmlParserCtxt *ctxt,
					 xmlInputReadCallback ioread,
					 xmlInputCloseCallback ioclose,
					 void *ioctx,
					 const char *URL,
					 const char *encoding,
					 int options);

/*
 * New input API
 */

XMLPUBFUN xmlParserErrors
xmlNewInputFromUrl(const char *url, xmlParserInputFlags flags,
                   xmlParserInput **out);
XMLPUBFUN xmlParserInput *
xmlNewInputFromMemory(const char *url, const void *mem, size_t size,
                      xmlParserInputFlags flags);
XMLPUBFUN xmlParserInput *
xmlNewInputFromString(const char *url, const char *str,
                      xmlParserInputFlags flags);
XMLPUBFUN xmlParserInput *
xmlNewInputFromFd(const char *url, int fd, xmlParserInputFlags flags);
XMLPUBFUN xmlParserInput *
xmlNewInputFromIO(const char *url, xmlInputReadCallback ioRead,
                  xmlInputCloseCallback ioClose, void *ioCtxt,
                  xmlParserInputFlags flags);
XMLPUBFUN xmlParserErrors
xmlInputSetEncodingHandler(xmlParserInput *input,
                           xmlCharEncodingHandler *handler);

/*
 * Library wide options
 */

/**
 * Used to examine the existence of features that can be enabled
 * or disabled at compile-time.
 * They used to be called XML_FEATURE_xxx but this clashed with Expat
 */
typedef enum {
    /** Multithreading support */
    XML_WITH_THREAD = 1,
    /** @deprecated Always available */
    XML_WITH_TREE = 2,
    /** Serialization support */
    XML_WITH_OUTPUT = 3,
    /** Push parser */
    XML_WITH_PUSH = 4,
    /** XML Reader */
    XML_WITH_READER = 5,
    /** Streaming patterns */
    XML_WITH_PATTERN = 6,
    /** XML Writer */
    XML_WITH_WRITER = 7,
    /** Legacy SAX1 API */
    XML_WITH_SAX1 = 8,
    /** @deprecated FTP support was removed */
    XML_WITH_FTP = 9,
    /** @deprecated HTTP support was removed */
    XML_WITH_HTTP = 10,
    /** DTD validation */
    XML_WITH_VALID = 11,
    /** HTML parser */
    XML_WITH_HTML = 12,
    /** Legacy symbols */
    XML_WITH_LEGACY = 13,
    /** Canonical XML */
    XML_WITH_C14N = 14,
    /** XML Catalogs */
    XML_WITH_CATALOG = 15,
    /** XPath */
    XML_WITH_XPATH = 16,
    /** XPointer */
    XML_WITH_XPTR = 17,
    /** XInclude */
    XML_WITH_XINCLUDE = 18,
    /** iconv */
    XML_WITH_ICONV = 19,
    /** Built-in ISO-8859-X */
    XML_WITH_ISO8859X = 20,
    /** @deprecated Removed */
    XML_WITH_UNICODE = 21,
    /** Regular expressions */
    XML_WITH_REGEXP = 22,
    /** @deprecated Same as XML_WITH_REGEXP */
    XML_WITH_AUTOMATA = 23,
    /** @deprecated Removed */
    XML_WITH_EXPR = 24,
    /** XML Schemas */
    XML_WITH_SCHEMAS = 25,
    /** Schematron */
    XML_WITH_SCHEMATRON = 26,
    /** Loadable modules */
    XML_WITH_MODULES = 27,
    /** Debugging API */
    XML_WITH_DEBUG = 28,
    /** @deprecated Removed */
    XML_WITH_DEBUG_MEM = 29,
    /** @deprecated Removed */
    XML_WITH_DEBUG_RUN = 30,
    /** GZIP compression */
    XML_WITH_ZLIB = 31,
    /** ICU */
    XML_WITH_ICU = 32,
    /** @deprecated LZMA support was removed */
    XML_WITH_LZMA = 33,
    /** RELAXNG, since 2.14 */
    XML_WITH_RELAXNG = 34,
    XML_WITH_NONE = 99999 /* just to be sure of allocation size */
} xmlFeature;

XMLPUBFUN int
		xmlHasFeature		(xmlFeature feature);

#ifdef __cplusplus
}
#endif
#endif /* __XML_PARSER_H__ */