libxml-rs 0.1.0-alpha.49

Native-Rust forensic reimplementation of libxml2+libxslt with C ABI drop-in replacement. Cross-version oracle matrix (libxml2 2.7.8-2.15.3, libxslt 1.1.26-1.1.45) with semantic epochs; full xmllint/xmlcatalog/xsltproc CLIs; differential-court-verified C API closure; three-DSO ELF packaging (libxml2.so.16 core + libxslt.so.1/libexslt.so.0 facades, upstream NEEDED chain); fail-closed oracle-isolated ABI-FUNCTION-SIGNATURE plane (SOURCE_PROTOTYPE + MACHINE_ABI fingerprints, zero silent omissions); Phase-12 real downstream substitution (binary/static/docker substitution, export-surface disposition, ELF version graphs); Phase-13 hostile audit courts (ABI/ownership/allocator/callbacks/failure/threads/oracle-contamination) byte-identical vs the system oracle incl. the upstream thread-local globals model; Phase-14 downstream custodian validation courts (lxml/Nokogiri/PHP/Debian). Test counts live in atlas/TEST_COUNTS.json, residuals in atlas/RESIDUAL_LEDGER.json (generated evidence).
Documentation
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
/**
 * @file
 *
 * XML parser API for libxml-rs
 */

#ifndef __XML_PARSER_H__
#define __XML_PARSER_H__

#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
#include <libxml/xmlmemory.h>
#include <libxml/tree.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlIO.h>
#include <libxml/xmlIO.h>
#include <libxml/hash.h>
#include <libxml/valid.h>
#include <libxml/encoding.h>
#include <libxml/SAX2.h>
#include <libxml/entities.h>

#ifdef __cplusplus
extern "C" {
#endif

/* Callback used to deallocate xmlParserInput buffers (upstream parser.h). */
typedef void (*xmlParserInputDeallocate)(xmlChar *str);





















































































































































/* Parser options */

/* Parser mode */
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;

/* Forward declarations */
struct _xmlValidCtxt;

/* Parser input states — verbatim from the upstream 2.15 header. The
 * numbering is ABI: `xmlParserCtxt.instate` is read by consumers compiled
 * against the real headers (PHP ext/xml expat-compat compares it against
 * XML_PARSER_CONTENT while resolving entity references), so these values
 * must match include/libxml/parser.h 2.15 exactly (SP-14.3.1-4, bug71592). */
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;

/* Phase 14 (DOWNSTREAM-LXML): internal bits in the 'loadsubset' context
 * member (upstream parser.h); consumers (lxml etree.c _initSaxDocument)
 * poke them directly. Verbatim from the upstream oracle header. */
#define XML_DETECT_IDS		2
#define XML_COMPLETE_ATTRS	4
#define XML_SKIP_IDS		8

/* Parser input structure (fwd typedef in SAX2.h; struct body here) */
struct _xmlParserInput {
    xmlParserInputBufferPtr buf;
    const char *filename;
    const char *directory;
    const xmlChar *base;
    const xmlChar *cur;
    const xmlChar *end;
    int length;
    int line;
    int col;
    unsigned long consumed;
    xmlParserInputDeallocate free;
    const xmlChar *encoding;
    const xmlChar *version;
    int flags;
    int id;
    unsigned long parentConsumed;
    xmlEntityPtr entity;
};

/* Parser input buffer (typedef in tree.h; struct body here) */
struct _xmlParserInputBuffer {
    void *context;
    xmlInputReadCallback readcallback;
    xmlInputCloseCallback closecallback;
    xmlCharEncodingHandlerPtr encoder;
    xmlBuf *buffer;
    xmlBuf *raw;
    int compressed;
    int error;
    unsigned long rawconsumed;
};

/* Output buffer (typedef in tree.h; struct body here) */
struct _xmlOutputBuffer {
    void *context;
    xmlOutputWriteCallback writecallback;
    xmlOutputCloseCallback closecallback;
    xmlCharEncodingHandlerPtr encoder;
    xmlBuf *buffer;
    xmlBuf *conv;
    int written;
    int error;
};

/* Resource types passed to xmlResourceLoader (upstream parser.h) */
typedef enum {
    XML_RESOURCE_UNKNOWN = 0,
    XML_RESOURCE_MAIN_DOCUMENT,
    XML_RESOURCE_DTD,
    XML_RESOURCE_GENERAL_ENTITY,
    XML_RESOURCE_PARAMETER_ENTITY,
    XML_RESOURCE_XINCLUDE,
    XML_RESOURCE_XINCLUDE_TEXT
} xmlResourceType;

/* Flags for parser input (upstream parser.h) */
typedef enum {
    XML_INPUT_BUF_STATIC = (1 << 1),
    XML_INPUT_BUF_ZERO_TERMINATED = (1 << 2),
    XML_INPUT_UNZIP = (1 << 3),
    XML_INPUT_NETWORK = (1 << 4),
    XML_INPUT_USE_SYS_CATALOG = (1 << 5)
} xmlParserInputFlags;

/* Opaque structs referenced by _xmlParserCtxt (upstream parser.h) */
typedef struct _xmlStartTag xmlStartTag;
typedef struct _xmlParserNsData xmlParserNsData;
typedef struct _xmlAttrHashBucket xmlAttrHashBucket;

/* Custom resource loader callback (upstream parser.h) */
typedef xmlParserErrors
(*xmlResourceLoader)(void *ctxt, const char *url, const char *publicId,
                     xmlResourceType type, xmlParserInputFlags flags,
                     xmlParserInput **out);

/* Parser context — forward typedefs live in tree.h (upstream order: tree.h
 * declares xmlParserCtxt/xmlParserInput so xmlIO.h can use them standalone). */
typedef xmlParserCtxt *xmlParserCtxtPtr;
struct _xmlParserCtxt {
    xmlSAXHandlerPtr sax;
    void *userData;
    xmlDocPtr myDoc;
    int wellFormed;
    int replaceEntities;
    const xmlChar *version;
    const xmlChar *encoding;
    int standalone;
    int html;
    xmlParserInputPtr input;
    int inputNr;
    int inputMax;
    xmlParserInputPtr *inputTab;
    xmlNodePtr node;
    int nodeNr;
    int nodeMax;
    xmlNodePtr *nodeTab;
    int record_info;
    xmlParserNodeInfoSeq node_seq;
    int errNo;
    int hasExternalSubset;
    int hasPErefs;
    int external;
    int valid;
    int validate;
    xmlValidCtxt vctxt;
    int instate;
    int token;
    char *directory;
    xmlChar *name;
    int nameNr;
    int nameMax;
    xmlChar **nameTab;
    long nbChars;
    long checkIndex;
    int keepBlanks;
    int disableSAX;
    int inSubset;
    const xmlChar *intSubName;
    xmlChar *extSubURI;
    xmlChar *extSubSystem;
    int *space;
    int spaceNr;
    int spaceMax;
    int *spaceTab;
    int depth;
    xmlParserInput *entity;
    int charset;
    int nodelen;
    int nodemem;
    int pedantic;
    void *_private;
    int loadsubset;
    int linenumbers;
    void *catalogs;
    int recovery;
    int progressive;
    xmlDictPtr dict;
    const xmlChar **atts;
    int maxatts;
    int docdict;
    const xmlChar *str_xml;
    const xmlChar *str_xmlns;
    const xmlChar *str_xml_ns;
    int sax2;
    int nsNr;
    int nsMax;
    const xmlChar **nsTab;
    unsigned int *attallocs;
    xmlStartTag *pushTab;
    xmlHashTablePtr attsDefault;
    xmlHashTablePtr attsSpecial;
    int nsWellFormed;
    int options;
    int dictNames;
    int freeElemsNr;
    xmlNode *freeElems;
    int freeAttrsNr;
    xmlAttr *freeAttrs;
    xmlError lastError;
    int parseMode;
    unsigned long nbentities;
    unsigned long sizeentities;
    xmlParserNodeInfoPtr nodeInfo;
    int nodeInfoNr;
    int nodeInfoMax;
    xmlParserNodeInfo *nodeInfoTab;
    int input_id;
    unsigned long sizeentcopy;
    int endCheckState;
    unsigned short nbErrors;
    unsigned short nbWarnings;
    unsigned int maxAmpl;
    xmlParserNsData *nsdb;
    unsigned int attrHashMax;
    xmlAttrHashBucket *attrHash;
    xmlStructuredErrorFunc errorHandler;
    void *errorCtxt;
    xmlResourceLoader resourceLoader;
    void *resourceCtxt;
    xmlCharEncConvImpl convImpl;
    void *convCtxt;
};


/* Init and cleanup */
XMLPUBFUN void xmlInitParser(void);
XMLPUBFUN void xmlCleanupParser(void);
XMLPUBFUN int xmlIsInitialized(void);

/* Reading APIs */
XMLPUBFUN xmlDocPtr xmlReadDoc(const xmlChar *cur, const char *URL,
                                const char *encoding, int options);
XMLPUBFUN xmlDocPtr xmlReadFile(const char *URL, const char *encoding, int options);
XMLPUBFUN xmlDocPtr xmlReadMemory(const char *buffer, int size,
                                   const char *URL, const char *encoding, int options);
XMLPUBFUN xmlDocPtr xmlReadFd(int fd, const char *URL,
                               const char *encoding, int options);
XMLPUBFUN xmlDocPtr xmlReadIO(xmlInputReadCallback ioread,
                               xmlInputCloseCallback ioclose,
                               void *ioctx, const char *URL,
                               const char *encoding, int options);

/* Parse APIs */
XMLPUBFUN xmlDocPtr xmlParseDoc(const xmlChar *cur);
XMLPUBFUN xmlDocPtr xmlParseFile(const char *filename);
XMLPUBFUN xmlDocPtr xmlParseMemory(const char *buffer, int size);

/* SAX APIs */
XMLPUBFUN xmlDocPtr xmlSAXParseDoc(xmlSAXHandlerPtr sax, const xmlChar *cur, int recovery);
XMLPUBFUN xmlDocPtr xmlSAXParseFile(xmlSAXHandlerPtr sax, const char *filename, int recovery);
XMLPUBFUN xmlDocPtr xmlSAXParseMemory(xmlSAXHandlerPtr sax,
                                       const char *buffer, int size, int recovery);
XMLPUBFUN int xmlSAXUserParseFile(xmlSAXHandlerPtr sax, void *user_data,
                                   const char *filename);
XMLPUBFUN int xmlSAXUserParseMemory(xmlSAXHandlerPtr sax, void *user_data,
                                     const char *buffer, int size);

/* Context APIs */
XMLPUBFUN xmlParserCtxtPtr xmlCreateFileParserCtxt(const char *filename);
XMLPUBFUN xmlParserCtxtPtr xmlCreateDocParserCtxt(const xmlChar *cur);
XMLPUBFUN int xmlParseDocument(xmlParserCtxtPtr ctxt);
XMLPUBFUN void xmlFreeParserCtxt(xmlParserCtxtPtr ctxt);
XMLPUBFUN int xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options);
XMLPUBFUN int xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk,
                             int size, int terminate);

XMLPUBFUN void xmlFreeParserCtxt(xmlParserCtxtPtr ctxt);
XMLPUBFUN int xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options);
XMLPUBFUN int xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk,
                             int size, int terminate);

/* Input buffer APIs — the xmlIO.h declarations (oracle-verbatim) are the
 * canonical ones; xmlParserInputBufferCreate* live in xmlIO.h upstream. */
XMLPUBFUN void xmlFreeParserInputBuffer(xmlParserInputBufferPtr buf);
XMLPUBFUN xmlParserInputPtr xmlNewInputFromFile(xmlParserCtxtPtr ctxt,
                                                 const char *filename);
XMLPUBFUN void xmlFreeInputStream(xmlParserInputPtr input);

/* Output buffer APIs */
XMLPUBFUN xmlOutputBufferPtr xmlOutputBufferCreateFilename(
    const char *URI, xmlCharEncodingHandlerPtr encoder, int compression);
XMLPUBFUN xmlOutputBufferPtr xmlOutputBufferCreateFd(
    int fd, xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr xmlOutputBufferCreateIO(
    xmlOutputWriteCallback iowrite, xmlOutputCloseCallback ioclose,
    void *ioctx, xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN int xmlOutputBufferClose(xmlOutputBufferPtr out);
XMLPUBFUN int xmlOutputBufferFlush(xmlOutputBufferPtr out);
XMLPUBFUN int xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *data);
XMLPUBFUN int xmlOutputBufferWriteString(xmlOutputBufferPtr out, const char *str);

















































































































































/* Deprecated default handlers (globals.c 2.15.3). */
typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1;
typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr;
XMLPUBVAR const xmlSAXHandlerV1 xmlDefaultSAXHandler;
XMLPUBVAR const xmlSAXLocator xmlDefaultSAXLocator;








/* [11.1-G] begin: extracted verbatim from upstream oracle header */
/**
 * SAX handler, version 1.
 *
 * @deprecated Use version 2 handlers.
 */

typedef enum{
    XML_PARSE_RECOVER = 1<<0,
    XML_PARSE_NOENT = 1<<1,
    XML_PARSE_DTDLOAD = 1<<2,
    XML_PARSE_DTDATTR = 1<<3,
    XML_PARSE_DTDVALID = 1<<4,
    XML_PARSE_NOERROR = 1<<5,
    XML_PARSE_NOWARNING = 1<<6,
    XML_PARSE_PEDANTIC = 1<<7,
    XML_PARSE_NOBLANKS = 1<<8,
    XML_PARSE_SAX1 = 1<<9,
    XML_PARSE_XINCLUDE = 1<<10,
    XML_PARSE_NONET = 1<<11,
    XML_PARSE_NODICT = 1<<12,
    XML_PARSE_NSCLEAN = 1<<13,
    XML_PARSE_NOCDATA = 1<<14,
    XML_PARSE_NOXINCNODE = 1<<15,
    XML_PARSE_COMPACT = 1<<16,
    XML_PARSE_OLD10 = 1<<17,
    XML_PARSE_NOBASEFIX = 1<<18,
    XML_PARSE_HUGE = 1<<19,
    XML_PARSE_OLDSAX = 1<<20,
    XML_PARSE_IGNORE_ENC = 1<<21,
    XML_PARSE_BIG_LINES = 1<<22,
    XML_PARSE_NO_XXE = 1<<23,
    XML_PARSE_UNZIP = 1<<24,
    XML_PARSE_NO_SYS_CATALOG = 1<<25,
    XML_PARSE_CATALOG_PI = 1<<26,
    XML_PARSE_SKIP_IDS = 1<<27
} xmlParserOption;

typedef enum{
    XML_STATUS_NOT_WELL_FORMED          = (1 << 0),
    XML_STATUS_NOT_NS_WELL_FORMED       = (1 << 1),
    XML_STATUS_DTD_VALIDATION_FAILED    = (1 << 2),
    XML_STATUS_CATASTROPHIC_ERROR       = (1 << 3)
} xmlParserStatus;

typedef enum{
    XML_WITH_THREAD = 1,
    XML_WITH_TREE = 2,
    XML_WITH_OUTPUT = 3,
    XML_WITH_PUSH = 4,
    XML_WITH_READER = 5,
    XML_WITH_PATTERN = 6,
    XML_WITH_WRITER = 7,
    XML_WITH_SAX1 = 8,
    XML_WITH_FTP = 9,
    XML_WITH_HTTP = 10,
    XML_WITH_VALID = 11,
    XML_WITH_HTML = 12,
    XML_WITH_LEGACY = 13,
    XML_WITH_C14N = 14,
    XML_WITH_CATALOG = 15,
    XML_WITH_XPATH = 16,
    XML_WITH_XPTR = 17,
    XML_WITH_XINCLUDE = 18,
    XML_WITH_ICONV = 19,
    XML_WITH_ISO8859X = 20,
    XML_WITH_UNICODE = 21,
    XML_WITH_REGEXP = 22,
    XML_WITH_AUTOMATA = 23,
    XML_WITH_EXPR = 24,
    XML_WITH_SCHEMAS = 25,
    XML_WITH_SCHEMATRON = 26,
    XML_WITH_MODULES = 27,
    XML_WITH_DEBUG = 28,
    XML_WITH_DEBUG_MEM = 29,
    XML_WITH_DEBUG_RUN = 30,
    XML_WITH_ZLIB = 31,
    XML_WITH_ICU = 32,
    XML_WITH_LZMA = 33,
    XML_WITH_RELAXNG = 34,
    XML_WITH_NONE = 99999 /* just to be sure of allocation size */
} xmlFeature;

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;
};

/* [11.1-G] end: extracted definitions */
#ifdef __cplusplus
extern "C" {
#endif
/* [11.1-L] begin: entity-loader declarations extracted verbatim from the
 * oracle libxml2 2.15.3 parser.h (exported by the candidate DSO). */
typedef xmlParserInput *(*xmlExternalEntityLoader) (const char *URL,
					 const char *publicId,
					 xmlParserCtxt *context);
XMLPUBFUN void
		xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
XMLPUBFUN xmlExternalEntityLoader
		xmlGetExternalEntityLoader(void);
/* [11.1-L] end: extracted declarations */

/* [11.1-S] begin: oracle-extracted declarations
 * Extracted verbatim from the upstream headers (11.1-S header-surface
 * audit: every function the oracle headers declare must be declared by the
 * drop-in headers — the source-compatibility contract. Signatures are the upstream ABI contract.
 */
XMLPUBVAR const char *const xmlParserVersion;

/* Phase 12 (EXTERNAL-CONSUMERS court): upstream parser.h defines
 * XML_DEFAULT_VERSION; testWriter.c and other unmodified upstream consumers
 * use it (xmlNewDoc(BAD_CAST XML_DEFAULT_VERSION)). */
#define XML_DEFAULT_VERSION "1.0"
XMLPUBFUN long xmlByteConsumed (xmlParserCtxt *ctxt);
XMLPUBFUN void xmlClearNodeInfoSeq (xmlParserNodeInfoSeq *seq);
XMLPUBFUN void xmlClearParserCtxt (xmlParserCtxt *ctxt);
XMLPUBFUN xmlParserCtxt * xmlCreateIOParserCtxt (xmlSAXHandler *sax, void *user_data, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc);
XMLPUBFUN xmlParserCtxt * xmlCreatePushParserCtxt(xmlSAXHandler *sax, void *user_data, const char *chunk, int size, const char *filename);
XMLPUBFUN void * xmlCtxtGetCatalogs (xmlParserCtxt *ctxt);
XMLPUBFUN const xmlChar * xmlCtxtGetDeclaredEncoding(xmlParserCtxt *ctxt);
XMLPUBFUN xmlDict * xmlCtxtGetDict (xmlParserCtxt *ctxt);
XMLPUBFUN int xmlCtxtGetDocTypeDecl (xmlParserCtxt *ctxt, const xmlChar **name, const xmlChar **systemId, const xmlChar **publicId);
XMLPUBFUN xmlDoc * xmlCtxtGetDocument (xmlParserCtxt *ctxt);
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 xmlNode * xmlCtxtGetNode (xmlParserCtxt *ctxt);
XMLPUBFUN int xmlCtxtGetOptions (xmlParserCtxt *ctxt);
XMLPUBFUN void * xmlCtxtGetPrivate (xmlParserCtxt *ctxt);
XMLPUBFUN xmlSAXHandler * xmlCtxtGetSaxHandler (xmlParserCtxt *ctxt);
XMLPUBFUN int xmlCtxtGetStandalone (xmlParserCtxt *ctxt);
XMLPUBFUN xmlParserStatus xmlCtxtGetStatus (xmlParserCtxt *ctxt);
XMLPUBFUN void * xmlCtxtGetUserData (xmlParserCtxt *ctxt);
XMLPUBFUN xmlValidCtxt * xmlCtxtGetValidCtxt (xmlParserCtxt *ctxt);
XMLPUBFUN const xmlChar * xmlCtxtGetVersion (xmlParserCtxt *ctxt);
XMLPUBFUN int xmlCtxtIsHtml (xmlParserCtxt *ctxt);
XMLPUBFUN int xmlCtxtIsInSubset (xmlParserCtxt *ctxt);
XMLPUBFUN int xmlCtxtIsStopped (xmlParserCtxt *ctxt);
XMLPUBFUN xmlNode * xmlCtxtParseContent (xmlParserCtxt *ctxt, xmlParserInput *input, xmlNode *node, int hasTextDecl);
XMLPUBFUN xmlDoc * xmlCtxtParseDocument (xmlParserCtxt *ctxt, xmlParserInput *input);
XMLPUBFUN xmlDtd * xmlCtxtParseDtd (xmlParserCtxt *ctxt, xmlParserInput *input, const xmlChar *publicId, const xmlChar *systemId);
XMLPUBFUN xmlDoc * xmlCtxtReadDoc (xmlParserCtxt *ctxt, const xmlChar *cur, 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 * xmlCtxtReadFile (xmlParserCtxt *ctxt, const char *filename, const char *encoding, int options);
XMLPUBFUN xmlDoc * xmlCtxtReadIO (xmlParserCtxt *ctxt, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options);
XMLPUBFUN xmlDoc * xmlCtxtReadMemory (xmlParserCtxt *ctxt, const char *buffer, int size, const char *URL, const char *encoding, int options);
XMLPUBFUN void xmlCtxtReset (xmlParserCtxt *ctxt);
XMLPUBFUN int xmlCtxtResetPush (xmlParserCtxt *ctxt, const char *chunk, int size, const char *filename, const char *encoding);
XMLPUBFUN void xmlCtxtSetCatalogs (xmlParserCtxt *ctxt, void *catalogs);
XMLPUBFUN void xmlCtxtSetCharEncConvImpl(xmlParserCtxt *ctxt, xmlCharEncConvImpl impl, void *vctxt);
XMLPUBFUN void xmlCtxtSetDict (xmlParserCtxt *ctxt, xmlDict *);
XMLPUBFUN void xmlCtxtSetErrorHandler (xmlParserCtxt *ctxt, xmlStructuredErrorFunc handler, void *data);
XMLPUBFUN void xmlCtxtSetMaxAmplification(xmlParserCtxt *ctxt, unsigned maxAmpl);
XMLPUBFUN int xmlCtxtSetOptions (xmlParserCtxt *ctxt, int options);
XMLPUBFUN void xmlCtxtSetPrivate (xmlParserCtxt *ctxt, void *priv);
XMLPUBFUN void xmlCtxtSetResourceLoader(xmlParserCtxt *ctxt, xmlResourceLoader loader, void *vctxt);
XMLPUBFUN int xmlCtxtSetSaxHandler (xmlParserCtxt *ctxt, const xmlSAXHandler *sax);
XMLPUBFUN int xmlCtxtValidateDocument (xmlParserCtxt *ctxt, xmlDoc *doc);
XMLPUBFUN int xmlCtxtValidateDtd (xmlParserCtxt *ctxt, xmlDoc *doc, xmlDtd *dtd);
XMLPUBFUN int xmlHasFeature (xmlFeature feature);
XMLPUBFUN xmlDtd * xmlIOParseDTD (xmlSAXHandler *sax, xmlParserInputBuffer *input, xmlCharEncoding enc);
XMLPUBFUN void xmlInitNodeInfoSeq (xmlParserNodeInfoSeq *seq);
XMLPUBFUN int xmlInitParserCtxt (xmlParserCtxt *ctxt);
XMLPUBFUN xmlParserErrors xmlInputSetEncodingHandler(xmlParserInput *input, xmlCharEncodingHandler *handler);
XMLPUBFUN int xmlKeepBlanksDefault (int val);
XMLPUBFUN int xmlLineNumbersDefault (int val);
XMLPUBFUN xmlParserInput * xmlLoadExternalEntity (const char *URL, const char *ID, xmlParserCtxt *ctxt);
XMLPUBFUN xmlParserInput * xmlNewIOInputStream (xmlParserCtxt *ctxt, xmlParserInputBuffer *input, xmlCharEncoding enc);
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 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 xmlParserErrors xmlNewInputFromUrl(const char *url, xmlParserInputFlags flags, xmlParserInput **out);
XMLPUBFUN xmlParserCtxt * xmlNewParserCtxt (void);
XMLPUBFUN xmlParserCtxt * xmlNewSAXParserCtxt (const xmlSAXHandler *sax, void *userData);
XMLPUBFUN int xmlParseBalancedChunkMemory(xmlDoc *doc, xmlSAXHandler *sax, void *user_data, int depth, const xmlChar *string, xmlNode **lst);
XMLPUBFUN int xmlParseBalancedChunkMemoryRecover(xmlDoc *doc, xmlSAXHandler *sax, void *user_data, int depth, const xmlChar *string, xmlNode **lst, int recover);
XMLPUBFUN int xmlParseCtxtExternalEntity(xmlParserCtxt *ctx, const xmlChar *URL, const xmlChar *ID, xmlNode **lst);
XMLPUBFUN xmlDtd * xmlParseDTD (const xmlChar *publicId, const xmlChar *systemId);
XMLPUBFUN xmlDoc * xmlParseEntity (const char *filename);
XMLPUBFUN int xmlParseExtParsedEnt (xmlParserCtxt *ctxt);
XMLPUBFUN int xmlParseExternalEntity (xmlDoc *doc, xmlSAXHandler *sax, void *user_data, int depth, const xmlChar *URL, const xmlChar *ID, xmlNode **lst);
XMLPUBFUN xmlParserErrors xmlParseInNodeContext (xmlNode *node, const char *data, int datalen, int options, xmlNode **lst);
XMLPUBFUN void xmlParserAddNodeInfo (xmlParserCtxt *ctxt, xmlParserNodeInfo *info);
XMLPUBFUN const xmlParserNodeInfo* xmlParserFindNodeInfo (xmlParserCtxt *ctxt, xmlNode *node);
XMLPUBFUN unsigned long xmlParserFindNodeInfoIndex(xmlParserNodeInfoSeq *seq, xmlNode *node);
XMLPUBFUN int xmlParserInputGrow (xmlParserInput *in, int len);
XMLPUBFUN int xmlParserInputRead (xmlParserInput *in, int len);
XMLPUBFUN int xmlPedanticParserDefault(int val);
XMLPUBFUN xmlDoc * xmlRecoverDoc (const xmlChar *cur);
XMLPUBFUN xmlDoc * xmlRecoverFile (const char *filename);
XMLPUBFUN xmlDoc * xmlRecoverMemory (const char *buffer, int size);
XMLPUBFUN xmlDtd * xmlSAXParseDTD (xmlSAXHandler *sax, const xmlChar *publicId, const xmlChar *systemId);
XMLPUBFUN xmlDoc * xmlSAXParseEntity (xmlSAXHandler *sax, const char *filename);
XMLPUBFUN xmlDoc * xmlSAXParseFileWithData (xmlSAXHandler *sax, const char *filename, int recovery, void *data);
XMLPUBFUN xmlDoc * xmlSAXParseMemoryWithData (xmlSAXHandler *sax, const char *buffer, int size, int recovery, void *data);
XMLPUBFUN void xmlSetupParserForBuffer (xmlParserCtxt *ctxt, const xmlChar* buffer, const char *filename);
XMLPUBFUN void xmlStopParser (xmlParserCtxt *ctxt);
XMLPUBFUN int xmlSubstituteEntitiesDefault(int val);
XMLPUBFUN int xmlThrDefDoValidityCheckingDefaultValue(int v);
XMLPUBFUN int xmlThrDefGetWarningsDefaultValue(int v);
XMLPUBFUN int xmlThrDefKeepBlanksDefaultValue(int v);
XMLPUBFUN int xmlThrDefLineNumbersDefaultValue(int v);
XMLPUBFUN int xmlThrDefLoadExtDtdDefaultValue(int v);
XMLPUBFUN int xmlThrDefPedanticParserDefaultValue(int v);
XMLPUBFUN int xmlThrDefSubstituteEntitiesDefaultValue(int v);
/* [11.1-S] end: oracle-extracted declarations */

/* [13.1] begin: thread-local global accessors + macro aliases
 *
 * Phase 13 (HOSTILE-THREADS): upstream 2.15 with LIBXML_THREAD_ENABLED keeps
 * these globals per-thread; the headers declare `(*__xmlXxx())` accessor
 * FUNCTIONS and alias the public names to them, and the DSO exports only the
 * accessors (nm -D: no data symbols). The candidate implements the same
 * contract (see src/xml/globals/tls.rs), so consumers compiled against these
 * headers get thread-local semantics like the oracle. Guarded by
 * XML_GLOBALS_NO_REDEFINITION exactly like upstream parser.h.
 */
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

#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_NOERROR.
   */
  #define xmlGetWarningsDefaultValue \
    (*__xmlGetWarningsDefaultValue())
  /**
   * Thread-local setting to keep or remove blank nodes. Defaults to 1.
   *
   * @deprecated Use the parser option XML_PARSE_NOBLANKS.
   */
  #define xmlKeepBlanksDefaultValue (*__xmlKeepBlanksDefaultValue())
  /**
   * Thread-local setting to output line numbers. Defaults to 1.
   *
   * @deprecated Use xmlLineNumbersDefault().
   */
  #define xmlLineNumbersDefaultValue \
    (*__xmlLineNumbersDefaultValue())
  /**
   * Thread-local setting to load external DTDs. Defaults to 0.
   *
   * @deprecated Use the parser option XML_PARSE_DTDLOAD.
   */
  #define xmlLoadExtDtdDefaultValue (*__xmlLoadExtDtdDefaultValue())
  /**
   * Thread-local setting to enable pedantic parsing. Defaults to 0.
   *
   * @deprecated Use the parser option XML_PARSE_PEDANTIC.
   */
  #define xmlPedanticParserDefaultValue \
    (*__xmlPedanticParserDefaultValue())
  /**
   * Thread-local setting to substitute entities. Defaults to 0.
   *
   * @deprecated Use the parser option XML_PARSE_NOENT.
   */
  #define xmlSubstituteEntitiesDefaultValue \
    (*__xmlSubstituteEntitiesDefaultValue())
#ifdef LIBXML_OUTPUT_ENABLED
  /**
   * Thread-local setting to indent tree output. Defaults to 1.
   *
   * @deprecated Use xmlThrDefIndentTreeOutput().
   */
  #define xmlIndentTreeOutput (*__xmlIndentTreeOutput())
  /**
   * Thread-local setting containing the tree indent string. Defaults to "  ".
   *
   * @deprecated Use xmlThrDefTreeIndentString().
   */
  #define xmlTreeIndentString (*__xmlTreeIndentString())
  /**
   * Thread-local setting to suppress empty tags in output. Defaults to 0.
   *
   * @deprecated Use xmlThrDefSaveNoEmptyTags().
   */
  #define xmlSaveNoEmptyTags (*__xmlSaveNoEmptyTags())
#endif
#endif /* XML_GLOBALS_NO_REDEFINITION */
/* [13.1] end: thread-local global accessors + macro aliases */

#ifdef __cplusplus
}
#endif


#ifdef __cplusplus
}
#endif

#endif /* __XML_PARSER_H__ */