Skip to main content

libxml_rs/abi/
types.rs

1// Lint policy (11.1-Z seal): `missing_docs` and
2// `missing_debug_implementations` are allowed here — the enums/constants
3// mirror upstream C typedefs and #define values whose canonical
4// documentation is the C header itself (the same rationale bindgen
5// applies to generated bindings). The numeric values are the contract,
6// verified against the oracle by the data-abi courts.
7#![allow(missing_docs, missing_debug_implementations)]
8
9//! C ABI type definitions — matching upstream libxml2/libxslt (§14).
10//!
11//! This module defines all public C-compatible types with exact layout,
12//! size, and alignment matching the upstream headers.
13//!
14//! # Layout verification
15//!
16//! Every struct in this module must be verified against the oracle using
17//! `offsetof` and `sizeof` probes compiled from the upstream headers.
18//! See courts/abi-struct-*.json for verification receipts.
19//!
20//! # Phase 1 status
21//!
22//! All core types are defined. Verification against oracle is pending
23//! Docker oracle build.
24//!
25//! # Source provenance
26//!
27//! All types derived from SRC-LIBXML2-2.15.3-TREE-H and related headers.
28//! See atlas/SOURCES.md and atlas/api/ for the complete declaration inventory.
29//!
30//! # Upstream contract
31//!
32//! Mirrors the public libxml2/libxslt type surface at the 2.15.3/1.1.45 parity
33//! target: `tree.h`, `parser.h`, `xpath.h`, `xmlerror.h`, `xmlreader.h`,
34//! `xmlwriter.h`, `encoding.h` and the libxslt headers. Enum discriminants and
35//! typedef values are the contract — C consumers compile against these exact
36//! numbers.
37//!
38//! # Conceptual behavior
39//!
40//! This module implements the fundamental C-compatible types: `xmlChar` and
41//! pointers, the `xmlElementType`/`xmlAttributeType`/`xmlEntityType` node
42//! kinds, the `xmlErrorLevel`/`xmlErrorDomain` and `XML_ERR_*` error codes,
43//! parser option flags, encoding ids, buffer allocation schemes and the
44//! XML/XMLNS constant pointers. These feed every other ABI module.
45//!
46//! # Ownership & safety invariants
47//!
48//! Enum/flag types carry no ownership; the string constants are static
49//! NUL-terminated slices never freed by callers. The numeric values must stay
50//! fixed: shifting an `XML_ERR_*` constant changes every error code the parser
51//! reports to C consumers.
52//!
53//! # Historical quirks & epochs
54//!
55//! R-000163 (11.1-M): the `XML_ERR_*` constants 64-96 were a synthetic
56//! renumbered enum (e.g. SPACE_REQUIRED 89 instead of upstream 65,
57//! TAG_NOT_FINISHED 96 instead of 77) and had to be corrected to the
58//! header/upstream numbering — every error the parser emits uses them.
59//! QUIRK-0001/LORE-0001 record the 2.9.0 default parser limits epoch (commit
60//! `52d8ade7`) and LORE-0003 that `XML_PARSE_HUGE` (1<<19) existed since 2.8.0
61//! as a near-no-op before the limits made it meaningful.
62//!
63//! # Deliberate oddities
64//!
65//! The `_deprecated_*`/`_unused_*` variants and historical enum values are
66//! deliberately retained even when the current code never produces them — the
67//! numeric surface is part of the ABI. Missing-docs is allowed here for the
68//! same reason as structs.rs: the C headers are the documentation.
69//!
70//! # Proving courts
71//!
72//! The ERROR-001 differential probe (`courts/suites/data-abi/error-family-
73//! probe.c`) verifies every error code/level/message byte-identical against
74//! the oracle DSO (48/48 cases); the RUST-MIRROR-ABI court checks enum
75//! discriminants; the header-compile court (571/571) compiles every public
76//! header against the candidate DSO.
77//!
78//! # Tempting simplifications that would break parity
79//!
80//! A tempting simplification is to renumber the error enums into a tidy
81//! contiguous sequence — R-000163 proved that shifts error codes silently
82//! (SPACE_REQUIRED 89 vs 65) and every C consumer matching on
83//! `XML_ERR_SPACE_REQUIRED` would misbehave. The values must match the
84//! upstream headers exactly, gaps and all.
85
86use std::os::raw::c_int;
87
88// ── Fundamental libxml2 types ───────────────────────────────────────────
89
90/// Basic type for all xmlChars (UTF-8 encoded bytes).
91pub type xmlChar = u8;
92
93/// Pointer to xmlChar.
94pub type xmlCharPtr = *mut xmlChar;
95
96/// Const pointer to xmlChar.
97pub type xmlConstCharPtr = *const xmlChar;
98
99// ── Character encoding (xmlCharEncoding) ──────────────────────────────
100//
101// Source: encoding.h lines 18-60
102
103/// Character encoding identifiers.
104#[repr(C)]
105#[derive(Debug, Clone, Copy, PartialEq, Eq)]
106pub enum xmlCharEncoding {
107    XML_CHAR_ENCODING_ERROR = -1,
108    XML_CHAR_ENCODING_NONE = 0,
109    XML_CHAR_ENCODING_UTF8 = 1,
110    XML_CHAR_ENCODING_UTF16LE = 2,
111    XML_CHAR_ENCODING_UTF16BE = 3,
112    XML_CHAR_ENCODING_UCS4LE = 4,
113    XML_CHAR_ENCODING_UCS4BE = 5,
114    XML_CHAR_ENCODING_EBCDIC = 6,
115    XML_CHAR_ENCODING_UCS4_2143 = 7,
116    XML_CHAR_ENCODING_UCS4_3412 = 8,
117    XML_CHAR_ENCODING_UCS2 = 9,
118    XML_CHAR_ENCODING_8859_1 = 10,
119    XML_CHAR_ENCODING_8859_2 = 11,
120    XML_CHAR_ENCODING_8859_3 = 12,
121    XML_CHAR_ENCODING_8859_4 = 13,
122    XML_CHAR_ENCODING_8859_5 = 14,
123    XML_CHAR_ENCODING_8859_6 = 15,
124    XML_CHAR_ENCODING_8859_7 = 16,
125    XML_CHAR_ENCODING_8859_8 = 17,
126    XML_CHAR_ENCODING_8859_9 = 18,
127    XML_CHAR_ENCODING_2022_JP = 19,
128    XML_CHAR_ENCODING_SHIFT_JIS = 20,
129    XML_CHAR_ENCODING_EUC_JP = 21,
130    XML_CHAR_ENCODING_ASCII = 22,
131}
132
133// ── Node types (xmlElementType) ─────────────────────────────────────────
134//
135// Source: tree.h lines 162-184
136// Provenance: SRC-LIBXML2-2.15.3-TREE-H
137
138/// Type of an XML element or node.
139///
140/// These values are part of the ABI and MUST NOT be changed.
141#[repr(C)]
142#[derive(Debug, Clone, Copy, PartialEq, Eq)]
143pub enum xmlElementType {
144    XML_ELEMENT_NODE = 1,
145    XML_ATTRIBUTE_NODE = 2,
146    XML_TEXT_NODE = 3,
147    XML_CDATA_SECTION_NODE = 4,
148    XML_ENTITY_REF_NODE = 5,
149    XML_ENTITY_NODE = 6,
150    XML_PI_NODE = 7,
151    XML_COMMENT_NODE = 8,
152    XML_DOCUMENT_NODE = 9,
153    XML_DOCUMENT_TYPE_NODE = 10,
154    XML_DOCUMENT_FRAG_NODE = 11,
155    XML_NOTATION_NODE = 12,
156    XML_HTML_DOCUMENT_NODE = 13,
157    XML_DTD_NODE = 14,
158    XML_ELEMENT_DECL = 15,
159    XML_ATTRIBUTE_DECL = 16,
160    XML_ENTITY_DECL = 17,
161    XML_NAMESPACE_DECL = 18,
162    XML_XINCLUDE_START = 19,
163    XML_XINCLUDE_END = 20,
164}
165
166/// Namespace type is typedef'd to xmlElementType in upstream.
167pub type xmlNsType = xmlElementType;
168
169/// XML_LOCAL_NAMESPACE macro equals XML_NAMESPACE_DECL.
170pub const XML_LOCAL_NAMESPACE: xmlElementType = xmlElementType::XML_NAMESPACE_DECL;
171
172// ── Document properties ─────────────────────────────────────────────────
173//
174// Source: tree.h lines 762-770
175
176/// Document properties flags.
177#[repr(C)]
178#[derive(Debug, Clone, Copy, PartialEq, Eq)]
179pub enum xmlDocProperties {
180    XML_DOC_WELLFORMED = 1 << 0,
181    XML_DOC_NSVALID = 1 << 1,
182    XML_DOC_OLD10 = 1 << 2,
183    XML_DOC_DTDVALID = 1 << 3,
184    XML_DOC_XINCLUDE = 1 << 4,
185    XML_DOC_USERBUILT = 1 << 5,
186    XML_DOC_INTERNAL = 1 << 6,
187    XML_DOC_HTML = 1 << 7,
188}
189
190// ── Buffer allocation scheme ────────────────────────────────────────────
191//
192// Source: tree.h lines 93-100
193
194#[repr(C)]
195#[derive(Debug, Clone, Copy, PartialEq, Eq)]
196pub enum xmlBufferAllocationScheme {
197    XML_BUFFER_ALLOC_DOUBLEIT = 0,
198    XML_BUFFER_ALLOC_EXACT = 1,
199    XML_BUFFER_ALLOC_IMMUTABLE = 2,
200    XML_BUFFER_ALLOC_IO = 3,
201    XML_BUFFER_ALLOC_HYBRID = 4,
202    XML_BUFFER_ALLOC_BOUNDED = 5,
203}
204
205// ── Attribute types ─────────────────────────────────────────────────────
206//
207// Source: tree.h lines 309-319
208
209#[repr(C)]
210#[derive(Debug, Clone, Copy, PartialEq, Eq)]
211pub enum xmlAttributeType {
212    XML_ATTRIBUTE_CDATA = 1,
213    XML_ATTRIBUTE_ID = 2,
214    XML_ATTRIBUTE_IDREF = 3,
215    XML_ATTRIBUTE_IDREFS = 4,
216    XML_ATTRIBUTE_ENTITY = 5,
217    XML_ATTRIBUTE_ENTITIES = 6,
218    XML_ATTRIBUTE_NMTOKEN = 7,
219    XML_ATTRIBUTE_NMTOKENS = 8,
220    XML_ATTRIBUTE_ENUMERATION = 9,
221    XML_ATTRIBUTE_NOTATION = 10,
222}
223
224// ── Attribute default modes ─────────────────────────────────────────────
225//
226// Source: tree.h lines 325-330
227
228#[repr(C)]
229#[derive(Debug, Clone, Copy, PartialEq, Eq)]
230pub enum xmlAttributeDefault {
231    XML_ATTRIBUTE_NONE = 1,
232    XML_ATTRIBUTE_REQUIRED = 2,
233    XML_ATTRIBUTE_IMPLIED = 3,
234    XML_ATTRIBUTE_FIXED = 4,
235}
236
237// ── Entity types ────────────────────────────────────────────────────────
238//
239// Source: entities.h lines 28-35
240
241#[repr(C)]
242#[derive(Debug, Clone, Copy, PartialEq, Eq)]
243pub enum xmlEntityType {
244    XML_INTERNAL_GENERAL_ENTITY = 1,
245    XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
246    XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
247    XML_INTERNAL_PARAMETER_ENTITY = 4,
248    XML_EXTERNAL_PARAMETER_ENTITY = 5,
249    XML_INTERNAL_PREDEFINED_ENTITY = 6,
250}
251
252// ── Element content types ───────────────────────────────────────────────
253//
254// Source: tree.h lines 396-401
255
256#[repr(C)]
257#[derive(Debug, Clone, Copy, PartialEq, Eq)]
258pub enum xmlElementContentType {
259    XML_ELEMENT_CONTENT_PCDATA = 1,
260    XML_ELEMENT_CONTENT_ELEMENT = 2,
261    XML_ELEMENT_CONTENT_SEQ = 3,
262    XML_ELEMENT_CONTENT_OR = 4,
263}
264
265// ── Element content occurrence ──────────────────────────────────────────
266//
267// Source: tree.h lines 406-410
268
269#[repr(C)]
270#[derive(Debug, Clone, Copy, PartialEq, Eq)]
271pub enum xmlElementContentOccur {
272    XML_ELEMENT_CONTENT_ONCE = 1,
273    XML_ELEMENT_CONTENT_OPT = 2,
274    XML_ELEMENT_CONTENT_MULT = 3,
275    XML_ELEMENT_CONTENT_PLUS = 4,
276}
277
278// ── Element type values ─────────────────────────────────────────────────
279//
280// Source: tree.h lines 443-450
281
282#[repr(C)]
283#[derive(Debug, Clone, Copy, PartialEq, Eq)]
284pub enum xmlElementTypeVal {
285    XML_ELEMENT_TYPE_UNDEFINED = 0,
286    XML_ELEMENT_TYPE_EMPTY = 1,
287    XML_ELEMENT_TYPE_ANY = 2,
288    XML_ELEMENT_TYPE_MIXED = 3,
289    XML_ELEMENT_TYPE_ELEMENT = 4,
290}
291
292// ── Error levels ────────────────────────────────────────────────────────
293//
294// Source: xmlerror.h
295
296#[repr(C)]
297#[derive(Debug, Clone, Copy, PartialEq, Eq)]
298pub enum xmlErrorLevel {
299    XML_ERR_NONE = 0,
300    XML_ERR_WARNING = 1,
301    XML_ERR_ERROR = 2,
302    XML_ERR_FATAL = 3,
303}
304
305// ── Parser modes ────────────────────────────────────────────────────────
306
307#[repr(C)]
308#[derive(Debug, Clone, Copy, PartialEq, Eq)]
309pub enum xmlParserMode {
310    XML_PARSE_UNKNOWN = 0,
311    XML_PARSE_DOM = 1,
312    XML_PARSE_SAX = 2,
313    XML_PARSE_PUSH_DOM = 3,
314    XML_PARSE_PUSH_SAX = 4,
315    XML_PARSE_READER = 5,
316}
317
318// ── Parser input state ──────────────────────────────────────────────────
319
320#[repr(C)]
321#[derive(Debug, Clone, Copy, PartialEq, Eq)]
322pub enum xmlParserInputState {
323    XML_PARSER_EOF = -1,
324    XML_PARSER_START = 0,
325    XML_PARSER_MISC = 1,
326    XML_PARSER_DTD = 2,
327    XML_PARSER_PROLOG = 3,
328    XML_PARSER_CONTENT = 4,
329    XML_PARSER_CDATA_SECTION = 5,
330    XML_PARSER_ENTITY_REF = 6,
331    XML_PARSER_ENTITY_VALUE = 7,
332    XML_PARSER_ATTRIBUTE_VALUE = 8,
333    XML_PARSER_SYSTEM_LITERAL = 9,
334    XML_PARSER_EPILOG = 10,
335    XML_PARSER_IGNORE = 11,
336    XML_PARSER_PUBLIC_LITERAL = 12,
337}
338
339// ── XPath object types ──────────────────────────────────────────────────
340
341#[repr(C)]
342#[derive(Debug, Clone, Copy, PartialEq, Eq)]
343pub enum xmlXPathObjectType {
344    XPATH_UNDEFINED = 0,
345    XPATH_NODESET = 1,
346    XPATH_BOOLEAN = 2,
347    XPATH_NUMBER = 3,
348    XPATH_STRING = 4,
349    XPATH_POINT = 5,
350    XPATH_RANGE = 6,
351    XPATH_LOCATIONSET = 7,
352    XPATH_USERS = 8,
353    XPATH_XSLT_TREE = 9,
354}
355
356// ── Parser option flags ─────────────────────────────────────────────────
357//
358// Source: parser.h
359
360pub const XML_PARSE_RECOVER: c_int = 1 << 0;
361pub const XML_PARSE_NOENT: c_int = 1 << 1;
362pub const XML_PARSE_DTDLOAD: c_int = 1 << 2;
363pub const XML_PARSE_DTDATTR: c_int = 1 << 3;
364pub const XML_PARSE_DTDVALID: c_int = 1 << 4;
365pub const XML_PARSE_NOERROR: c_int = 1 << 5;
366pub const XML_PARSE_NOWARNING: c_int = 1 << 6;
367pub const XML_PARSE_PEDANTIC: c_int = 1 << 7;
368pub const XML_PARSE_NOBLANKS: c_int = 1 << 8;
369pub const XML_PARSE_SAX1: c_int = 1 << 9;
370pub const XML_PARSE_XINCLUDE: c_int = 1 << 10;
371pub const XML_PARSE_NONET: c_int = 1 << 11;
372pub const XML_PARSE_NODICT: c_int = 1 << 12;
373pub const XML_PARSE_NSCLEAN: c_int = 1 << 13;
374pub const XML_PARSE_NOCDATA: c_int = 1 << 14;
375pub const XML_PARSE_NOXINCNODE: c_int = 1 << 15;
376pub const XML_PARSE_COMPACT: c_int = 1 << 16;
377pub const XML_PARSE_OLD10: c_int = 1 << 17;
378pub const XML_PARSE_NOBASEFIX: c_int = 1 << 18;
379pub const XML_PARSE_HUGE: c_int = 1 << 19;
380pub const XML_PARSE_OLDSAX: c_int = 1 << 20;
381pub const XML_PARSE_IGNORE_ENC: c_int = 1 << 21;
382pub const XML_PARSE_BIG_LINES: c_int = 1 << 22;
383pub const XML_PARSE_NO_XXE: c_int = 1 << 23;
384pub const XML_PARSE_UNZIP: c_int = 1 << 24;
385pub const XML_PARSE_NO_SYS_CATALOG: c_int = 1 << 25;
386pub const XML_PARSE_CATALOG_PI: c_int = 1 << 26;
387pub const XML_PARSE_SKIP_IDS: c_int = 1 << 27;
388
389// ── Error domains ───────────────────────────────────────────────────────
390//
391// Source: xmlerror.h
392
393pub const XML_FROM_NONE: c_int = 0;
394pub const XML_FROM_PARSER: c_int = 1;
395pub const XML_FROM_TREE: c_int = 2;
396pub const XML_FROM_NAMESPACE: c_int = 3;
397pub const XML_FROM_DTD: c_int = 4;
398pub const XML_FROM_HTML: c_int = 5;
399pub const XML_FROM_MEMORY: c_int = 6;
400pub const XML_FROM_OUTPUT: c_int = 7;
401pub const XML_FROM_IO: c_int = 8;
402pub const XML_FROM_FTP: c_int = 9;
403pub const XML_FROM_HTTP: c_int = 10;
404pub const XML_FROM_XINCLUDE: c_int = 11;
405pub const XML_FROM_XPATH: c_int = 12;
406pub const XML_FROM_XPOINTER: c_int = 13;
407pub const XML_FROM_REGEXP: c_int = 14;
408pub const XML_FROM_DATATYPE: c_int = 15;
409pub const XML_FROM_SCHEMASP: c_int = 16;
410pub const XML_FROM_SCHEMASV: c_int = 17;
411pub const XML_FROM_RELAXNGP: c_int = 18;
412pub const XML_FROM_RELAXNGV: c_int = 19;
413pub const XML_FROM_CATALOG: c_int = 20;
414pub const XML_FROM_C14N: c_int = 21;
415pub const XML_FROM_XSLT: c_int = 22;
416pub const XML_FROM_VALID: c_int = 23;
417pub const XML_FROM_CHECK: c_int = 24;
418pub const XML_FROM_WRITER: c_int = 25;
419pub const XML_FROM_MODULE: c_int = 26;
420pub const XML_FROM_I18N: c_int = 27;
421pub const XML_FROM_SCHEMATRONV: c_int = 28;
422pub const XML_FROM_BUFFER: c_int = 29;
423pub const XML_FROM_URI: c_int = 30;
424
425// ── Parser error codes ──────────────────────────────────────────────────
426//
427// Source: xmlerror.h (xmlParserErrors enum)
428
429pub const XML_ERR_OK: c_int = 0;
430pub const XML_ERR_INTERNAL_ERROR: c_int = 1;
431pub const XML_ERR_NO_MEMORY: c_int = 2;
432pub const XML_ERR_DOCUMENT_START: c_int = 3;
433pub const XML_ERR_DOCUMENT_EMPTY: c_int = 4;
434pub const XML_ERR_DOCUMENT_END: c_int = 5;
435pub const XML_ERR_INVALID_HEX_CHARREF: c_int = 6;
436pub const XML_ERR_INVALID_DEC_CHARREF: c_int = 7;
437pub const XML_ERR_INVALID_CHARREF: c_int = 8;
438pub const XML_ERR_INVALID_CHAR: c_int = 9;
439pub const XML_ERR_CHARREF_AT_EOF: c_int = 10;
440pub const XML_ERR_CHARREF_IN_PROLOG: c_int = 11;
441pub const XML_ERR_CHARREF_IN_EPILOG: c_int = 12;
442pub const XML_ERR_CHARREF_IN_DTD: c_int = 13;
443pub const XML_ERR_ENTITYREF_AT_EOF: c_int = 14;
444pub const XML_ERR_ENTITYREF_IN_PROLOG: c_int = 15;
445pub const XML_ERR_ENTITYREF_IN_EPILOG: c_int = 16;
446pub const XML_ERR_ENTITYREF_IN_DTD: c_int = 17;
447pub const XML_ERR_PEREF_AT_EOF: c_int = 18;
448pub const XML_ERR_PEREF_IN_PROLOG: c_int = 19;
449pub const XML_ERR_PEREF_IN_EPILOG: c_int = 20;
450pub const XML_ERR_PEREF_IN_INT_SUBSET: c_int = 21;
451pub const XML_ERR_ENTITYREF_NO_NAME: c_int = 22;
452pub const XML_ERR_ENTITYREF_SEMICOL_MISSING: c_int = 23;
453pub const XML_ERR_PEREF_NO_NAME: c_int = 24;
454pub const XML_ERR_PEREF_SEMICOL_MISSING: c_int = 25;
455pub const XML_ERR_UNDECLARED_ENTITY: c_int = 26;
456pub const XML_WAR_UNDECLARED_ENTITY: c_int = 27;
457pub const XML_ERR_UNPARSED_ENTITY: c_int = 28;
458pub const XML_ERR_ENTITY_IS_EXTERNAL: c_int = 29;
459pub const XML_ERR_ENTITY_IS_PARAMETER: c_int = 30;
460pub const XML_ERR_UNKNOWN_ENCODING: c_int = 31;
461pub const XML_ERR_UNSUPPORTED_ENCODING: c_int = 32;
462pub const XML_ERR_STRING_NOT_STARTED: c_int = 33;
463pub const XML_ERR_STRING_NOT_CLOSED: c_int = 34;
464pub const XML_ERR_NS_DECL_ERROR: c_int = 35;
465pub const XML_ERR_ENTITY_NOT_STARTED: c_int = 36;
466pub const XML_ERR_ENTITY_NOT_FINISHED: c_int = 37;
467pub const XML_ERR_LT_IN_ATTRIBUTE: c_int = 38;
468pub const XML_ERR_ATTRIBUTE_NOT_STARTED: c_int = 39;
469pub const XML_ERR_ATTRIBUTE_NOT_FINISHED: c_int = 40;
470pub const XML_ERR_ATTRIBUTE_WITHOUT_VALUE: c_int = 41;
471pub const XML_ERR_ATTRIBUTE_REDEFINED: c_int = 42;
472pub const XML_ERR_LITERAL_NOT_STARTED: c_int = 43;
473pub const XML_ERR_LITERAL_NOT_FINISHED: c_int = 44;
474pub const XML_ERR_COMMENT_NOT_FINISHED: c_int = 45;
475pub const XML_ERR_PI_NOT_STARTED: c_int = 46;
476pub const XML_ERR_PI_NOT_FINISHED: c_int = 47;
477pub const XML_ERR_NOTATION_NOT_STARTED: c_int = 48;
478pub const XML_ERR_NOTATION_NOT_FINISHED: c_int = 49;
479pub const XML_ERR_ATTLIST_NOT_STARTED: c_int = 50;
480pub const XML_ERR_ATTLIST_NOT_FINISHED: c_int = 51;
481pub const XML_ERR_MIXED_NOT_STARTED: c_int = 52;
482pub const XML_ERR_MIXED_NOT_FINISHED: c_int = 53;
483pub const XML_ERR_ELEMCONTENT_NOT_STARTED: c_int = 54;
484pub const XML_ERR_ELEMCONTENT_NOT_FINISHED: c_int = 55;
485pub const XML_ERR_XMLDECL_NOT_STARTED: c_int = 56;
486pub const XML_ERR_XMLDECL_NOT_FINISHED: c_int = 57;
487pub const XML_ERR_CONDSEC_NOT_STARTED: c_int = 58;
488pub const XML_ERR_CONDSEC_NOT_FINISHED: c_int = 59;
489pub const XML_ERR_EXT_SUBSET_NOT_FINISHED: c_int = 60;
490pub const XML_ERR_DOCTYPE_NOT_FINISHED: c_int = 61;
491pub const XML_ERR_MISPLACED_CDATA_END: c_int = 62;
492pub const XML_ERR_CDATA_NOT_FINISHED: c_int = 63;
493pub const XML_ERR_RESERVED_XML_NAME: c_int = 64;
494pub const XML_ERR_SPACE_REQUIRED: c_int = 65;
495pub const XML_ERR_SEPARATOR_REQUIRED: c_int = 66;
496pub const XML_ERR_NMTOKEN_REQUIRED: c_int = 67;
497pub const XML_ERR_NAME_REQUIRED: c_int = 68;
498pub const XML_ERR_PCDATA_REQUIRED: c_int = 69;
499pub const XML_ERR_URI_REQUIRED: c_int = 70;
500pub const XML_ERR_PUBID_REQUIRED: c_int = 71;
501pub const XML_ERR_LT_REQUIRED: c_int = 72;
502pub const XML_ERR_GT_REQUIRED: c_int = 73;
503pub const XML_ERR_LTSLASH_REQUIRED: c_int = 74;
504pub const XML_ERR_EQUAL_REQUIRED: c_int = 75;
505pub const XML_ERR_TAG_NAME_MISMATCH: c_int = 76;
506pub const XML_ERR_TAG_NOT_FINISHED: c_int = 77;
507pub const XML_ERR_STANDALONE_VALUE: c_int = 78;
508pub const XML_ERR_ENCODING_NAME: c_int = 79;
509pub const XML_ERR_HYPHEN_IN_COMMENT: c_int = 80;
510pub const XML_ERR_INVALID_ENCODING: c_int = 81;
511pub const XML_ERR_EXT_ENTITY_STANDALONE: c_int = 82;
512pub const XML_ERR_CONDSEC_INVALID: c_int = 83;
513pub const XML_ERR_VALUE_REQUIRED: c_int = 84;
514pub const XML_ERR_NOT_WELL_BALANCED: c_int = 85;
515pub const XML_ERR_EXTRA_CONTENT: c_int = 86;
516pub const XML_ERR_ENTITY_CHAR_ERROR: c_int = 87;
517pub const XML_ERR_ENTITY_PE_INTERNAL: c_int = 88;
518pub const XML_ERR_ENTITY_LOOP: c_int = 89;
519pub const XML_ERR_ENTITY_BOUNDARY: c_int = 90;
520pub const XML_ERR_INVALID_URI: c_int = 91;
521pub const XML_ERR_URI_FRAGMENT: c_int = 92;
522pub const XML_WAR_CATALOG_PI: c_int = 93;
523pub const XML_ERR_NO_DTD: c_int = 94;
524pub const XML_ERR_RESOURCE_LIMIT: c_int = 114;
525pub const XML_ERR_CONDSEC_INVALID_KEYWORD: c_int = 95;
526pub const XML_ERR_VERSION_MISSING: c_int = 96;
527pub const XML_ERR_ARGUMENT: c_int = 115;
528pub const XML_IO_ENOENT: c_int = 1524;
529// Removed: duplicate of XML_ERR_NAME_TOO_LONG at line 414
530
531// ── Parser limits ──────────────────────────────────────────────────────
532//
533// Source: parserInternals.h
534
535pub const XML_MAX_TEXT_LENGTH: c_int = 10_000_000;
536pub const XML_MAX_NAME_LENGTH: c_int = 50_000;
537pub const XML_MAX_DICTIONARY_LIMIT: c_int = 1_000_000;
538pub const XML_MAX_LOOKUP_LIMIT: c_int = 1_000_000;
539pub const XML_MAX_HUGE_LENGTH: c_int = 100_000_000;
540
541// ── XPath parser-context error codes (upstream xmlXPathError) ──────────
542//
543// Source: xpath.h (typedef enum { ... } xmlXPathError). The numeric values
544// are part of the observable ABI (ctxt->error after evaluation).
545
546pub const XPATH_EXPRESSION_OK: c_int = 0;
547pub const XPATH_NUMBER_ERROR: c_int = 1;
548pub const XPATH_UNFINISHED_LITERAL_ERROR: c_int = 2;
549pub const XPATH_START_LITERAL_ERROR: c_int = 3;
550pub const XPATH_VARIABLE_REF_ERROR: c_int = 4;
551pub const XPATH_UNDEF_VARIABLE_ERROR: c_int = 5;
552pub const XPATH_INVALID_PREDICATE_ERROR: c_int = 6;
553pub const XPATH_EXPR_ERROR: c_int = 7;
554pub const XPATH_UNCLOSED_ERROR: c_int = 8;
555pub const XPATH_UNKNOWN_FUNC_ERROR: c_int = 9;
556pub const XPATH_INVALID_OPERAND: c_int = 10;
557pub const XPATH_INVALID_TYPE: c_int = 11;
558pub const XPATH_INVALID_ARITY: c_int = 12;
559pub const XPATH_INVALID_CTXT_SIZE: c_int = 13;
560pub const XPATH_INVALID_CTXT_POSITION: c_int = 14;
561pub const XPATH_MEMORY_ERROR: c_int = 15;
562pub const XPTR_SYNTAX_ERROR: c_int = 16;
563pub const XPTR_RESOURCE_ERROR: c_int = 17;
564pub const XPTR_SUB_RESOURCE_ERROR: c_int = 18;
565pub const XPATH_UNDEF_PREFIX_ERROR: c_int = 19;
566pub const XPATH_ENCODING_ERROR: c_int = 20;
567pub const XPATH_INVALID_CHAR_ERROR: c_int = 21;
568pub const XPATH_INVALID_CTXT: c_int = 22;
569pub const XPATH_STACK_ERROR: c_int = 23;
570pub const XPATH_FORBID_VARIABLE_ERROR: c_int = 24;
571pub const XPATH_OP_LIMIT_EXCEEDED: c_int = 25;
572pub const XPATH_RECURSION_LIMIT_EXCEEDED: c_int = 26;
573pub const XML_MAX_NAMELEN: c_int = 100;
574pub const XML_MAX_ATTRIBUTE_LENGTH: c_int = 500_000;
575
576// ── Version constants ──────────────────────────────────────────────────
577
578pub const LIBXML2_VERSION: &str = "2.15.3";
579pub const LIBXML2_VERSION_MAJOR: c_int = 2;
580pub const LIBXML2_VERSION_MINOR: c_int = 15;
581pub const LIBXML2_VERSION_MICRO: c_int = 3;
582pub const LIBXML2_VERSION_NUMBER: c_int = 21503;
583pub const LIBXML2_VERSION_EXTRA: &str = "";
584
585pub const LIBXSLT_VERSION: &str = "1.1.45";
586pub const LIBXSLT_VERSION_MAJOR: c_int = 1;
587pub const LIBXSLT_VERSION_MINOR: c_int = 1;
588pub const LIBXSLT_VERSION_MICRO: c_int = 45;
589pub const LIBXSLT_VERSION_NUMBER: c_int = 10145;
590pub const LIBXSLT_VERSION_EXTRA: &str = "";
591
592// ── SAX2 magic value ───────────────────────────────────────────────────
593
594pub const XML_SAX2_MAGIC: c_int = 0xDEEDBEAFu32 as i32;