Skip to main content

libxml_rs/abi/
structs.rs

1//! C ABI struct definitions — exact upstream layout (§14, §17).
2//!
3//! Every struct in this module is laid out to match the corresponding
4//! upstream C struct byte-for-byte on the target platform.
5//!
6//! # Upstream structs
7//!
8//! All structs derived from SRC-LIBXML2-2.15.3-TREE-H and related headers.
9//! See the sub-agent extraction output for complete field-level archaeology.
10//!
11//! # Safety
12//!
13//! These structs are `#[repr(C)]` and may be passed across the FFI boundary.
14//! Fields marked `_deprecated_*` or `_unused_*` are retained for ABI
15//! compatibility even when the upstream has deprecated them.
16//!
17//! # Phase 1 status
18//!
19//! All core tree structs, error struct, parser context, SAX handler,
20//! XPath context/object, and I/O structs are defined.
21//!
22//! # ABI verification
23//!
24//! Each struct must be verified with `offsetof`/`sizeof` probes compiled
25//! from upstream headers. See courts/abi-struct-*.json for receipts.
26
27use crate::abi::callbacks::*;
28use crate::abi::types::*;
29use std::os::raw::{c_char, c_int, c_long, c_uint, c_ulong, c_ushort, c_void};
30
31// ── Forward declarations ────────────────────────────────────────────────
32//
33// These are the internal struct tags. In C, these are typedef'd to
34// pointer types. We define them as opaque handles or full structs
35// depending on whether the struct is public or opaque.
36
37// Opaque types (defined in .c files, not exposed in headers):
38//   _xmlDict, _xmlHashTable, _xmlList, _xmlRegexp, _xmlCatalog,
39//   _xmlXPathCompExpr, _xmlAutomata, _xmlPattern
40
41// ── xmlBuffer ───────────────────────────────────────────────────────────
42//
43// Source: tree.h lines 109-126
44
45/// Buffer structure. Deprecated in favor of xmlBuf.
46#[repr(C)]
47pub struct _xmlBuffer {
48    pub content: *mut xmlChar,   // The buffer content UTF8 (deprecated)
49    pub use_: c_uint,            // The buffer size used (deprecated)
50    pub size: c_uint,            // The buffer size (deprecated)
51    pub alloc: c_int,            // The realloc method (deprecated)
52    pub contentIO: *mut xmlChar, // In IO mode may have different base (deprecated)
53}
54
55// ── xmlNotation ─────────────────────────────────────────────────────────
56//
57// Source: tree.h lines 297-305
58
59/// Notation declaration.
60#[repr(C)]
61pub struct _xmlNotation {
62    pub name: *const xmlChar,     // Notation name
63    pub PublicID: *const xmlChar, // Public identifier, if any
64    pub SystemID: *const xmlChar, // System identifier, if any
65}
66
67// ── xmlEnumeration ──────────────────────────────────────────────────────
68//
69// Source: tree.h lines 341-345
70
71/// Enumeration value for attribute declarations.
72#[repr(C)]
73pub struct _xmlEnumeration {
74    pub next: *mut _xmlEnumeration, // Next in enumeration (deprecated)
75    pub name: *const xmlChar,       // Enumeration value
76}
77
78// ── xmlAttribute (declaration) ──────────────────────────────────────────
79//
80// Source: tree.h lines 357-391
81// NOTE: This is the ATTRIBUTE DECLARATION struct, not attribute node.
82// Attribute node is _xmlAttr below.
83
84/// Attribute declaration from DTD.
85#[repr(C)]
86pub struct _xmlAttribute {
87    pub _private: *mut c_void,   // Application data
88    pub type_: c_int,            // XML_ATTRIBUTE_DECL
89    pub name: *const xmlChar,    // Attribute name
90    pub children: *mut _xmlNode, // NULL
91    pub last: *mut _xmlNode,     // NULL
92    pub parent: *mut _xmlDtd,    // DTD
93    pub next: *mut _xmlNode,     // Next sibling
94    pub prev: *mut _xmlNode,     // Previous sibling
95    pub doc: *mut _xmlDoc,       // Containing document
96
97    pub nexth: *mut _xmlAttribute,  // Next in hash table
98    pub atype: c_int,               // Attribute type
99    pub def: c_int,                 // Attribute default
100    pub defaultValue: *mut xmlChar, // Default value
101    pub tree: *mut _xmlEnumeration, // Enumeration tree (deprecated)
102    pub prefix: *const xmlChar,     // Namespace prefix
103    pub elem: *const xmlChar,       // Element name
104}
105
106// ── xmlElementContent ───────────────────────────────────────────────────
107//
108// Source: tree.h lines 423-438
109
110/// Element content model.
111#[repr(C)]
112pub struct _xmlElementContent {
113    pub type_: c_int,                    // PCDATA, ELEMENT, SEQ or OR (deprecated)
114    pub ocur: c_int,                     // ONCE, OPT, MULT or PLUS (deprecated)
115    pub name: *const xmlChar,            // Element name (deprecated)
116    pub c1: *mut _xmlElementContent,     // First child (deprecated)
117    pub c2: *mut _xmlElementContent,     // Second child (deprecated)
118    pub parent: *mut _xmlElementContent, // Parent (deprecated)
119    pub prefix: *const xmlChar,          // Namespace prefix (deprecated)
120}
121
122// ── xmlElement (declaration) ────────────────────────────────────────────
123//
124// Source: tree.h lines 447-474
125
126/// Element declaration from DTD.
127#[repr(C)]
128pub struct _xmlElement {
129    pub name: *const xmlChar,             // Element name
130    pub type_: c_int,                     // xmlElementTypeVal
131    pub content: *mut _xmlElementContent, // Content model
132    pub attributes: *mut _xmlAttribute,   // Linked list of attribute declarations
133    pub prefix: *const xmlChar,           // Namespace prefix
134    pub next: *mut _xmlElement,           // Next in hash chain
135    pub _private: c_int,                  // Application data
136}
137
138// ── xmlNs ───────────────────────────────────────────────────────────────
139//
140// Source: tree.h lines 501-512
141
142/// Namespace declaration or XPath namespace node.
143#[repr(C)]
144pub struct _xmlNs {
145    pub next: *mut _xmlNs,      // Next namespace
146    pub type_: c_int,           // XML_NAMESPACE_DECL
147    pub href: *const xmlChar,   // Namespace URI
148    pub prefix: *const xmlChar, // Namespace prefix
149    pub _private: *mut c_void,  // Application data
150    pub context: *mut _xmlDoc,  // Normally an xmlDoc (deprecated)
151}
152
153// ── xmlDtd ──────────────────────────────────────────────────────────────
154//
155// Source: tree.h lines 538-564
156
157/// DTD (Document Type Definition).
158#[repr(C)]
159pub struct _xmlDtd {
160    pub _private: *mut c_void,   // Application data
161    pub type_: c_int,            // XML_DTD_NODE
162    pub name: *const xmlChar,    // Name of the DTD
163    pub children: *mut _xmlNode, // First child
164    pub last: *mut _xmlNode,     // Last child
165    pub parent: *mut _xmlDoc,    // Parent node (document)
166    pub next: *mut _xmlNode,     // Next sibling
167    pub prev: *mut _xmlNode,     // Previous sibling
168    pub doc: *mut _xmlDoc,       // Containing document
169    // End of common part
170    pub notations: *mut c_void,   // Hash table for notations
171    pub elements: *mut c_void,    // Hash table for elements
172    pub attributes: *mut c_void,  // Hash table for attributes
173    pub entities: *mut c_void,    // Hash table for entities
174    pub ExternalID: *mut xmlChar, // Public identifier
175    pub SystemID: *mut xmlChar,   // System identifier
176    pub pentities: *mut c_void,   // Hash table for parameter entities
177}
178
179// ── xmlAttr ─────────────────────────────────────────────────────────────
180//
181// Source: tree.h lines 595-615
182
183/// Attribute node.
184#[repr(C)]
185pub struct _xmlAttr {
186    pub _private: *mut c_void,   // Application data
187    pub type_: c_int,            // XML_ATTRIBUTE_NODE
188    pub name: *const xmlChar,    // Local name
189    pub children: *mut _xmlNode, // First child (text value)
190    pub last: *mut _xmlNode,     // Last child
191    pub parent: *mut _xmlNode,   // Parent node
192    pub next: *mut _xmlAttr,     // Next sibling (attribute)
193    pub prev: *mut _xmlAttr,     // Previous sibling (attribute)
194    pub doc: *mut _xmlDoc,       // Containing document
195    pub ns: *mut _xmlNs,         // Namespace if any
196    pub atype: c_int,            // Attribute type
197    pub psvi: *mut c_void,       // Type/PSVI information
198    pub id: *mut c_void,         // ID struct (deprecated)
199}
200
201// ── xmlNode ─────────────────────────────────────────────────────────────
202//
203// Source: tree.h lines 645-688
204
205/// XML node — the core tree structure.
206#[repr(C)]
207pub struct _xmlNode {
208    pub _private: *mut c_void,   // Application data
209    pub type_: c_int,            // Type enum
210    pub name: *const xmlChar,    // Node name
211    pub children: *mut _xmlNode, // First child
212    pub last: *mut _xmlNode,     // Last child
213    pub parent: *mut _xmlNode,   // Parent node (NULL for documents)
214    pub next: *mut _xmlNode,     // Next sibling
215    pub prev: *mut _xmlNode,     // Previous sibling
216    pub doc: *mut _xmlDoc,       // Associated document
217    // End of common part
218    pub ns: *mut _xmlNs,           // Namespace of element
219    pub content: *mut xmlChar,     // Content (text/comment/PI)
220    pub properties: *mut _xmlAttr, // First attribute of element
221    pub nsDef: *mut _xmlNs,        // First namespace definition
222    pub psvi: *mut c_void,         // Type/PSVI information
223    pub line: c_ushort,            // Line number
224    pub extra: c_ushort,           // Extra data for XPath/XSLT
225}
226
227// ── xmlDoc ──────────────────────────────────────────────────────────────
228//
229// Source: tree.h lines 787-845
230
231/// XML Document.
232#[repr(C)]
233pub struct _xmlDoc {
234    pub _private: *mut c_void,   // Application data
235    pub type_: c_int,            // XML_DOCUMENT_NODE or XML_HTML_DOCUMENT_NODE
236    pub name: *mut c_char,       // NULL
237    pub children: *mut _xmlNode, // First child (root element)
238    pub last: *mut _xmlNode,     // Last child
239    pub parent: *mut _xmlNode,   // Parent node
240    pub next: *mut _xmlNode,     // Next sibling
241    pub prev: *mut _xmlNode,     // Previous sibling
242    pub doc: *mut _xmlDoc,       // Reference to itself
243    // End of common part
244    pub compression: c_int,      // Level of zlib compression
245    pub standalone: c_int,       // Standalone document status
246    pub intSubset: *mut _xmlDtd, // Internal subset
247    pub extSubset: *mut _xmlDtd, // External subset
248    pub oldNs: *mut _xmlNs,      // Old namespace (used during parsing)
249    pub version: *mut xmlChar,   // Version string from XML declaration
250    pub encoding: *mut xmlChar,  // Actual encoding
251    pub ids: *mut c_void,        // Hash table for ID attributes
252    pub refs: *mut c_void,       // Hash table for IDREFs (deprecated)
253    pub URL: *mut xmlChar,       // URI of the document
254    pub charset: c_int,          // Unused (encoding indicator)
255    pub dict: *mut c_void,       // Dictionary for names (opaque _xmlDict)
256    pub psvi: *mut c_void,       // Type/PSVI information
257    pub parseFlags: c_int,       // Parser options used
258    pub properties: c_int,       // Document properties flags
259}
260
261// ── xmlEntity ───────────────────────────────────────────────────────────
262//
263// Source: entities.h lines 42-74
264
265/// Entity declaration.
266#[repr(C)]
267pub struct _xmlEntity {
268    pub _private: *mut c_void,      // Application data
269    pub type_: c_int,               // XML_ENTITY_DECL (must be second!)
270    pub name: *const xmlChar,       // Entity name
271    pub children: *mut _xmlNode,    // First child link
272    pub last: *mut _xmlNode,        // Last child link
273    pub parent: *mut _xmlDtd,       // -> DTD
274    pub next: *mut _xmlNode,        // Next sibling link
275    pub prev: *mut _xmlNode,        // Previous sibling link
276    pub doc: *mut _xmlDoc,          // The containing document
277    pub orig: *mut xmlChar,         // Content without ref substitution
278    pub content: *mut xmlChar,      // Content or ndata if unparsed
279    pub length: c_int,              // The content length
280    pub etype: c_int,               // The entity type
281    pub ExternalID: *const xmlChar, // External identifier for PUBLIC
282    pub SystemID: *const xmlChar,   // URI for SYSTEM or PUBLIC Entity
283    pub nexte: *mut _xmlEntity,     // Unused
284    pub URI: *const xmlChar,        // The full URI as computed
285    pub owner: c_int,               // Unused
286    pub flags: c_int,               // Various flags
287    pub expandedSize: c_ulong,      // Expanded size
288}
289
290// ── xmlError ────────────────────────────────────────────────────────────
291//
292// Source: xmlerror.h
293
294/// Structured error information.
295#[repr(C)]
296pub struct _xmlError {
297    pub domain: c_int,        // Error domain
298    pub code: c_int,          // Error code
299    pub message: *mut c_char, // Human-readable error message
300    pub level: c_int,         // Error level
301    pub file: *mut c_char,    // Filename if available
302    pub line: c_int,          // Line number if available
303    pub str1: *mut c_char,    // Extra string information
304    pub str2: *mut c_char,    // Extra string information
305    pub str3: *mut c_char,    // Extra string information
306    pub int1: c_int,          // Extra number information
307    pub int2: c_int,          // Column number if available
308    pub ctxt: *mut c_void,    // Parser context if available
309    pub node: *mut c_void,    // Node if available
310}
311
312// ── xmlParserInput ──────────────────────────────────────────────────────
313//
314// Source: parser.h
315
316/// Parser input stream.
317#[repr(C)]
318pub struct _xmlParserInput {
319    pub buf: *mut _xmlParserInputBuffer, // Input buffer (deprecated)
320    pub filename: *const c_char,         // The filename or URI (deprecated)
321    pub directory: *const c_char,        // Unused (deprecated)
322    pub base: *const xmlChar,            // Base of the array to parse
323    pub cur: *const xmlChar,             // Current char being parsed (deprecated)
324    pub end: *const xmlChar,             // End of the array to parse
325    pub length: c_int,                   // Unused (deprecated)
326    pub line: c_int,                     // Current line (deprecated)
327    pub col: c_int,                      // Current column (deprecated)
328    pub consumed: c_ulong,               // How many xmlChars consumed (deprecated)
329    pub free: Option<unsafe extern "C" fn(*mut c_char)>, // Deallocation func (deprecated)
330    pub encoding: *const xmlChar,        // Unused (deprecated)
331    pub version: *const xmlChar,         // The version string for entity (deprecated)
332    pub flags: c_int,                    // Flags (deprecated)
333    pub id: c_int,                       // Unique identifier (deprecated)
334    pub parentConsumed: c_ulong,         // Unused (deprecated)
335    pub entity: *mut _xmlEntity,         // Entity if any (deprecated)
336}
337
338// ── xmlParserInputBuffer ────────────────────────────────────────────────
339//
340// Source: xmlIO.h
341
342/// Parser input buffer.
343#[repr(C)]
344pub struct _xmlParserInputBuffer {
345    pub context: *mut c_void,                         // (deprecated)
346    pub readcallback: Option<xmlInputReadCallback>,   // (deprecated)
347    pub closecallback: Option<xmlInputCloseCallback>, // (deprecated)
348    pub encoder: *mut c_void,                         // I18N converter (deprecated)
349    pub buffer: *mut c_void,                          // Local buffer (deprecated)
350    pub raw: *mut c_void,                             // Raw input buffer (deprecated)
351    pub compressed: c_int,                            // Compression flag (deprecated)
352    pub error: c_int,                                 // (deprecated)
353    pub rawconsumed: c_ulong,                         // (deprecated)
354}
355
356// ── xmlOutputBuffer ─────────────────────────────────────────────────────
357//
358// Source: xmlIO.h
359
360/// Output buffer.
361#[repr(C)]
362pub struct _xmlOutputBuffer {
363    pub context: *mut c_void,                          // (deprecated)
364    pub writecallback: Option<xmlOutputWriteCallback>, // (deprecated)
365    pub closecallback: Option<xmlOutputCloseCallback>, // (deprecated)
366    pub encoder: *mut c_void,                          // I18N converter
367    pub buffer: *mut c_void,                           // Local buffer
368    pub conv: *mut c_void,                             // Output conversion buffer
369    pub written: c_int,                                // Total bytes written
370    pub error: c_int,                                  // Error flag
371}
372
373// ── xmlCharEncodingHandler ───────────────────────────────────────────────
374//
375// Source: encoding.h
376
377/// Character encoding conversion handler.
378#[repr(C)]
379pub struct _xmlCharEncodingHandler {
380    pub name: *mut c_char,                              // Encoding name
381    pub input: c_int,                                   // Input xmlCharEncoding
382    pub output: c_int,                                  // Output xmlCharEncoding
383    pub input_func: Option<xmlCharEncodingInputFunc>,   // Input conversion func
384    pub output_func: Option<xmlCharEncodingOutputFunc>, // Output conversion func
385    pub iconv_in: *mut c_void,                          // Iconv descriptor for input
386    pub iconv_out: *mut c_void,                         // Iconv descriptor for output
387}
388
389// ── xmlBuf ──────────────────────────────────────────────────────────────
390//
391// Source: tree.h
392
393/// Buffer structure (modern replacement for xmlBuffer).
394#[repr(C)]
395pub struct _xmlBuf {
396    pub content: *mut xmlChar, // The buffer content UTF8
397    pub use_: c_uint,          // The buffer size used
398    pub size: c_uint,          // The buffer size
399    pub alloc: c_int,          // The realloc method
400    pub error: c_int,          // Error flag
401    pub buffer: c_int,         // Is this a buffer from xmlBuffer?
402    pub io: c_int,             // In IO mode?
403}
404
405// ── xmlSAXHandler ───────────────────────────────────────────────────────
406//
407// Source: parser.h
408
409/// SAX event handler structure.
410#[repr(C)]
411pub struct _xmlSAXHandler {
412    pub internalSubset: Option<internalSubsetSAXFunc>,
413    pub isStandalone: Option<isStandaloneSAXFunc>,
414    pub hasInternalSubset: Option<hasInternalSubsetSAXFunc>,
415    pub hasExternalSubset: Option<hasExternalSubsetSAXFunc>,
416    pub resolveEntity: Option<resolveEntitySAXFunc>,
417    pub getEntity: Option<getEntitySAXFunc>,
418    pub entityDecl: Option<entityDeclSAXFunc>,
419    pub notationDecl: Option<notationDeclSAXFunc>,
420    pub attributeDecl: Option<attributeDeclSAXFunc>,
421    pub elementDecl: Option<elementDeclSAXFunc>,
422    pub unparsedEntityDecl: Option<unparsedEntityDeclSAXFunc>,
423    pub setDocumentLocator: Option<setDocumentLocatorSAXFunc>,
424    pub startDocument: Option<startDocumentSAXFunc>,
425    pub endDocument: Option<endDocumentSAXFunc>,
426    pub startElement: Option<startElementSAXFunc>,
427    pub endElement: Option<endElementSAXFunc>,
428    pub reference: Option<referenceSAXFunc>,
429    pub characters: Option<charactersSAXFunc>,
430    pub ignorableWhitespace: Option<ignorableWhitespaceSAXFunc>,
431    pub processingInstruction: Option<processingInstructionSAXFunc>,
432    pub comment: Option<commentSAXFunc>,
433    pub warning: Option<warningSAXFunc>,
434    pub error: Option<errorSAXFunc>,
435    pub fatalError: Option<fatalErrorSAXFunc>,
436    pub getParameterEntity: Option<getParameterEntitySAXFunc>,
437    pub cdataBlock: Option<cdataBlockSAXFunc>,
438    pub externalSubset: Option<externalSubsetSAXFunc>,
439    pub initialized: c_uint,
440    pub _private: *mut c_void,
441    pub startElementNs: Option<startElementNsSAX2Func>,
442    pub endElementNs: Option<endElementNsSAX2Func>,
443    pub serror: Option<xmlStructuredErrorFunc>,
444}
445
446// ── xmlParserCtxt ───────────────────────────────────────────────────────
447//
448// Source: parser.h
449
450/// Parser context — the primary parsing state structure.
451#[repr(C)]
452pub struct _xmlParserCtxt {
453    pub sax: *mut _xmlSAXHandler, // SAX handler (deprecated)
454    pub userData: *mut c_void,    // User data (deprecated)
455    pub myDoc: *mut _xmlDoc,      // Document being built (deprecated)
456    pub wellFormed: c_int,        // Is document well formed? (deprecated)
457    pub replaceEntities: c_int,   // Replace entities? (deprecated)
458    pub version: *mut xmlChar,    // XML version string (deprecated)
459    pub encoding: *mut xmlChar,   // Declared encoding (deprecated)
460    pub standalone: c_int,        // Standalone document (deprecated)
461    pub html: c_int,              // HTML document (deprecated)
462    // Input stream stack
463    pub input: *mut _xmlParserInput,         // Current input stream
464    pub inputNr: c_int,                      // Number of current input streams
465    pub inputMax: c_int,                     // Max number of input streams (deprecated)
466    pub inputTab: *mut *mut _xmlParserInput, // Stack of inputs
467    // Node analysis stack
468    pub node: *mut _xmlNode,         // Current element (deprecated)
469    pub nodeNr: c_int,               // Depth of parsing stack (deprecated)
470    pub nodeMax: c_int,              // Max depth (deprecated)
471    pub nodeTab: *mut *mut _xmlNode, // Array of nodes (deprecated)
472    // Node info
473    pub record_info: c_int,             // Whether node info should be kept
474    pub node_seq: xmlParserNodeInfoSeq, // Info about each node parsed (deprecated)
475    // Error
476    pub errNo: c_int, // Error code (deprecated)
477    // Reference and external subset
478    pub hasExternalSubset: c_int, // (deprecated)
479    pub hasPErefs: c_int,         // (deprecated)
480    pub external: c_int,          // (deprecated)
481    pub valid: c_int,             // Is document valid? (deprecated)
482    pub validate: c_int,          // Validate flag (deprecated)
483    pub vctxt: _xmlValidCtxt,     // Validity context
484    // Push parser state
485    pub instate: c_int,         // (deprecated)
486    pub token: c_int,           // (deprecated)
487    pub directory: *mut c_char, // Document directory (deprecated)
488    // Node name stack
489    pub name: *const xmlChar,         // Current parsed Node (deprecated)
490    pub nameNr: c_int,                // (deprecated)
491    pub nameMax: c_int,               // (deprecated)
492    pub nameTab: *mut *const xmlChar, // (deprecated)
493    // Misc
494    pub nbChars: c_long,            // (deprecated)
495    pub checkIndex: c_long,         // (deprecated)
496    pub keepBlanks: c_int,          // (deprecated)
497    pub disableSAX: c_int,          // (deprecated)
498    pub inSubset: c_int,            // DTD parsing state (deprecated)
499    pub intSubName: *const xmlChar, // Internal subset name (deprecated)
500    pub extSubURI: *mut xmlChar,    // External subset URI (deprecated)
501    pub extSubSystem: *mut xmlChar, // External subset public ID (deprecated)
502    // xml:space values
503    pub space: *mut c_int,    // (deprecated)
504    pub spaceNr: c_int,       // (deprecated)
505    pub spaceMax: c_int,      // (deprecated)
506    pub spaceTab: *mut c_int, // (deprecated)
507    // Entity loop prevention
508    pub depth: c_int,                 // (deprecated)
509    pub entity: *mut _xmlParserInput, // (deprecated)
510    pub charset: c_int,               // (deprecated)
511    pub nodelen: c_int,               // (deprecated)
512    pub nodemem: c_int,               // (deprecated)
513    pub pedantic: c_int,              // (deprecated)
514    pub _private: *mut c_void,        // User data (deprecated)
515    pub loadsubset: c_int,            // Load external subset (deprecated)
516    pub linenumbers: c_int,           // (deprecated)
517    pub catalogs: *mut c_void,        // (deprecated)
518    pub recovery: c_int,              // Recovery mode (deprecated)
519    pub progressive: c_int,           // (deprecated)
520    pub dict: *mut c_void,            // Dictionary (deprecated)
521    pub atts: *mut *const xmlChar,    // Attributes array (deprecated)
522    pub maxatts: c_int,               // (deprecated)
523    pub docdict: c_int,               // (deprecated)
524    // Pre-interned strings
525    pub str_xml: *const xmlChar,    // (deprecated)
526    pub str_xmlns: *const xmlChar,  // (deprecated)
527    pub str_xml_ns: *const xmlChar, // (deprecated)
528    // New SAX mode
529    pub sax2: c_int,                // (deprecated)
530    pub nsNr: c_int,                // (deprecated)
531    pub nsMax: c_int,               // (deprecated)
532    pub nsTab: *mut *const xmlChar, // (deprecated)
533    pub attallocs: *mut c_uint,     // (deprecated)
534    pub pushTab: *mut c_void,       // xmlStartTag (deprecated)
535    pub attsDefault: *mut c_void,   // (deprecated)
536    pub attsSpecial: *mut c_void,   // (deprecated)
537    pub nsWellFormed: c_int,        // (deprecated)
538    pub options: c_int,             // Extra options (deprecated)
539    pub dictNames: c_int,           // (deprecated)
540    // Streaming
541    pub freeElemsNr: c_int,       // (deprecated)
542    pub freeElems: *mut _xmlNode, // (deprecated)
543    pub freeAttrsNr: c_int,       // (deprecated)
544    pub freeAttrs: *mut _xmlAttr, // (deprecated)
545    pub lastError: _xmlError,     // Last error info (deprecated)
546    pub parseMode: c_int,         // (deprecated)
547    pub nbentities: c_ulong,      // (deprecated)
548    pub sizeentities: c_ulong,    // (deprecated)
549    // HTML non-recursive parser
550    pub nodeInfo: *mut c_void,    // (deprecated)
551    pub nodeInfoNr: c_int,        // (deprecated)
552    pub nodeInfoMax: c_int,       // (deprecated)
553    pub nodeInfoTab: *mut c_void, // (deprecated)
554    pub input_id: c_int,          // (deprecated)
555    pub sizeentcopy: c_ulong,     // (deprecated)
556    pub endCheckState: c_int,     // (deprecated)
557    pub nbErrors: c_ushort,       // (deprecated)
558    pub nbWarnings: c_ushort,     // (deprecated)
559    pub maxAmpl: c_uint,          // (deprecated)
560    // Namespace database
561    pub nsdb: *mut c_void,     // (deprecated)
562    pub attrHashMax: c_uint,   // (deprecated)
563    pub attrHash: *mut c_void, // (deprecated)
564    // Error handler
565    pub errorHandler: Option<xmlStructuredErrorFunc>, // (deprecated)
566    pub errorCtxt: *mut c_void,                       // (deprecated)
567    // Resource loader
568    pub resourceLoader: Option<xmlResourceLoader>, // (deprecated)
569    pub resourceCtxt: *mut c_void,                 // (deprecated)
570    // Encoding conversion
571    pub convImpl: Option<xmlCharEncConvImpl>, // (deprecated)
572    pub convCtxt: *mut c_void,                // (deprecated)
573}
574
575// ── xmlValidCtxt ────────────────────────────────────────────────────────
576//
577// Source: valid.h
578
579/// Validation context.
580#[repr(C)]
581pub struct _xmlValidCtxt {
582    pub userData: *mut c_void,                   // User specific data
583    pub error: Option<xmlValidityErrorFunc>,     // Error callback
584    pub warning: Option<xmlValidityWarningFunc>, // Warning callback
585    pub node: *mut _xmlNode,                     // Current parsed Node
586    pub nodeNr: c_int,                           // Depth of the parsing stack
587    pub nodeMax: c_int,                          // Max depth
588    pub nodeTab: *mut *mut _xmlNode,             // Array of nodes
589    pub flags: c_uint,                           // Internal flags
590    pub doc: *mut _xmlDoc,                       // The document
591    pub valid: c_int,                            // Temporary validity check result
592    pub vstate: *mut c_void,                     // Current validation state
593    pub vstateNr: c_int,                         // Depth of validation stack
594    pub vstateMax: c_int,                        // Max depth
595    pub vstateTab: *mut c_void,                  // Array of validation states
596    pub am: *mut c_void,                         // Automata
597    pub state: *mut c_void,                      // Automata state
598}
599
600// ── xmlParserNodeInfo ───────────────────────────────────────────────────
601
602/// Node info for parser tracking.
603#[repr(C)]
604pub struct _xmlParserNodeInfo {
605    pub node: *const _xmlNode,
606    pub begin_pos: c_ulong,
607    pub begin_line: c_ulong,
608    pub end_pos: c_ulong,
609    pub end_line: c_ulong,
610}
611
612/// Node info sequence.
613#[repr(C)]
614pub struct _xmlParserNodeInfoSeq {
615    pub block: *mut _xmlParserNodeInfo,
616    pub index: *mut c_int,
617    pub block_max: c_int,
618    pub size: c_int,
619}
620
621/// Typedef alias for `_xmlParserNodeInfoSeq`.
622pub type xmlParserNodeInfoSeq = _xmlParserNodeInfoSeq;
623
624// ── xmlXPathContext ─────────────────────────────────────────────────────
625//
626// Source: xpath.h
627
628/// XPath evaluation context.
629#[repr(C)]
630pub struct _xmlXPathContext {
631    pub doc: *mut _xmlDoc,                                 // The current document
632    pub node: *mut _xmlNode,                               // The current node
633    pub nb_variables_unused: c_int,                        // (unused)
634    pub max_variables_unused: c_int,                       // (unused)
635    pub varHash: *mut c_void,                              // Hash table of defined variables
636    pub nb_types: c_int,                                   // Number of defined types
637    pub max_types: c_int,                                  // Max number of types
638    pub types: *mut c_void,                                // Array of defined types (xmlXPathType)
639    pub nb_funcs_unused: c_int,                            // (unused)
640    pub max_funcs_unused: c_int,                           // (unused)
641    pub funcHash: *mut c_void,                             // Hash table of defined funcs
642    pub nb_axis: c_int,                                    // Number of defined axis
643    pub max_axis: c_int,                                   // Max number of axis
644    pub axis: *mut c_void,                                 // Array of defined axis (xmlXPathAxis)
645    pub namespaces: *mut *mut _xmlNs,                      // Array of namespaces
646    pub nsNr: c_int,                                       // Number of namespaces in scope
647    pub user: *mut c_void,                                 // Function to free
648    pub contextSize: c_int,                                // Context size
649    pub proximityPosition: c_int,                          // Proximity position
650    pub xptr: c_int,                                       // XPointer context?
651    pub here: *mut _xmlNode,                               // For here()
652    pub origin: *mut _xmlNode,                             // For origin()
653    pub nsHash: *mut c_void,                               // Namespaces hash table
654    pub varLookupFunc: Option<xmlXPathVariableLookupFunc>, // Variable lookup func
655    pub varLookupData: *mut c_void,                        // Variable lookup data
656    pub extra: *mut c_void,                                // Needed for XSLT
657    pub function: *const xmlChar,                          // Function name when calling a function
658    pub functionURI: *const xmlChar,                       // Function namespace URI
659    pub funcLookupFunc: Option<xmlXPathFuncLookupFunc>,    // Function lookup func
660    pub funcLookupData: *mut c_void,                       // Function lookup data
661    pub tmpNsList: *mut *mut _xmlNs,                       // Array of temp namespaces
662    pub tmpNsNr: c_int,                                    // Number of temp namespaces
663    pub userData: *mut c_void,                             // User specific data
664    pub error: Option<xmlStructuredErrorFunc>,             // Error callback
665    pub lastError: _xmlError,                              // Last error
666    pub debugNode: *mut _xmlNode,                          // Source node (XSLT)
667    pub dict: *mut c_void,                                 // Dictionary
668    pub flags: c_int,                                      // Compilation flags
669    pub cache: *mut c_void,                                // Cache for XPath objects
670    pub opLimit: c_ulong,                                  // Resource limits
671    pub opCount: c_ulong,
672    pub depth: c_int,
673}
674
675// ── xmlXPathObject ──────────────────────────────────────────────────────
676//
677// Source: xpath.h
678
679/// XPath evaluated object.
680#[repr(C)]
681pub struct _xmlXPathObject {
682    pub type_: c_int,            // Object type
683    pub nodesetval: *mut c_void, // Node set (xmlNodeSet)
684    pub boolval: c_int,          // Boolean value
685    pub floatval: f64,           // Number value
686    pub stringval: *mut xmlChar, // String value
687    pub user: *mut c_void,       // User pointer
688    pub index: c_int,            // Index
689    pub user2: *mut c_void,      // User pointer 2
690    pub index2: c_int,           // Index 2
691}
692
693// ── Node set (contained within XPath objects) ───────────────────────────
694
695/// XPath node set.
696#[repr(C)]
697pub struct _xmlNodeSet {
698    pub nodeNr: c_int,               // Number of nodes
699    pub nodeMax: c_int,              // Max number of nodes
700    pub nodeTab: *mut *mut _xmlNode, // Array of nodes
701}
702
703// ── XSLT types ──────────────────────────────────────────────────────────
704//
705// ═══════════════════════════════════════════════════════════════════════════════
706// XSLT Types (Phase 8)
707// ═══════════════════════════════════════════════════════════════════════════════
708// Source: xslt.h, xsltInternals.h (from libxslt)
709
710/// XSLT stylesheet — the compiled representation of an XSLT stylesheet.
711///
712/// # UPSTREAM-PARITY
713///
714/// Layout matches upstream `_xsltStylesheet` from xsltInternals.h (libxslt 1.1.39).
715/// Field order and types match the C struct exactly for ABI compatibility.
716///
717/// Courts: XSLT-STYLESHEET-*
718#[repr(C)]
719pub struct _xsltStylesheet {
720    /// The stylesheet document (the parsed XML of the .xsl file).
721    pub doc: *mut _xmlDoc,
722
723    /// Ordered list of templates (highest priority first).
724    pub templates: *mut _xsltTemplate,
725
726    /// Unused/freed templates for recycling.
727    pub templatesFree: *mut _xsltTemplate,
728
729    /// Hash for template lookup by name/mode.
730    pub internalHash: *mut c_void,
731
732    /// Key definitions.
733    pub keys: *mut _xsltKeyDef,
734
735    /// Parent stylesheet (for import tree).
736    pub parent: *mut _xsltStylesheet,
737
738    /// Next stylesheet in import chain.
739    pub next: *mut _xsltStylesheet,
740
741    /// Imported stylesheets (linked list).
742    pub imports: *mut _xsltStylesheet,
743
744    /// Output method ("xml", "html", "text", or custom).
745    pub method: *const xmlChar,
746
747    /// Method namespace URI (for custom output methods).
748    pub methodURI: *const xmlChar,
749
750    /// Version string for output.
751    pub version: *const xmlChar,
752
753    /// Output encoding.
754    pub encoding: *const xmlChar,
755
756    /// Omit XML declaration (0 = include, 1 = omit).
757    pub omitXmlDeclaration: c_int,
758
759    /// Standalone declaration (0 = no, 1 = yes, -1 = auto).
760    pub standalone: c_int,
761
762    /// Namespace list for output.
763    pub nsList: *mut *mut xmlChar,
764
765    /// Number of namespaces in nsList.
766    pub nsNr: c_int,
767
768    /// Maximum capacity of nsList.
769    pub nsMax: c_int,
770
771    /// Hash of decimal format definitions.
772    pub decimalFormat: *mut c_void,
773
774    /// Hash of namespace aliases.
775    pub nsAliases: *mut c_void,
776
777    /// Hash of attribute sets.
778    pub attributeSets: *mut c_void,
779
780    /// Hash of global variables.
781    pub variables: *mut c_void,
782
783    /// Hash of global parameters.
784    pub params: *mut c_void,
785
786    /// Hash of strip-space elements.
787    pub stripSpaces: *mut c_void,
788
789    /// Hash of preserve-space elements.
790    pub preserveSpaces: *mut c_void,
791
792    /// Error count during compilation.
793    pub errors: c_int,
794
795    /// Warning count during compilation.
796    pub warnings: c_int,
797
798    /// Stylesheet name (URI).
799    pub name: *const xmlChar,
800
801    /// Profiling flags.
802    pub profile: c_int,
803
804    /// Hash of extension information.
805    pub extInfos: *mut c_void,
806
807    /// Security preferences.
808    pub secPrefs: *mut c_void,
809
810    /// Skip default namespace flag.
811    pub skipDefaultNS: c_int,
812
813    /// Indent output (0 = no, 1 = yes, -1 = auto).
814    pub indent: c_int,
815
816    /// DOCTYPE public identifier.
817    pub doctypePublic: *const xmlChar,
818
819    /// DOCTYPE system identifier.
820    pub doctypeSystem: *const xmlChar,
821
822    /// Media type (for output).
823    pub mediaType: *const xmlChar,
824
825    /// PSVI data.
826    pub psvi: *mut c_void,
827
828    /// Number of global variables.
829    pub varsNr: c_int,
830
831    /// Maximum global variables.
832    pub varsMax: c_int,
833
834    /// Variables table.
835    pub varsTab: *mut c_void,
836
837    /// Deep context flag (internal).
838    pub deepCtxt: c_int,
839
840    /// Include count.
841    pub includes: c_int,
842}
843
844/// XSLT transform context — holds runtime state during a transformation.
845///
846/// # UPSTREAM-PARITY
847///
848/// Layout matches upstream `_xsltTransformContext` from xsltInternals.h (libxslt 1.1.39).
849///
850/// Courts: XSLT-TRANSFORM-*
851#[repr(C)]
852pub struct _xsltTransformContext {
853    /// Current stylesheet being applied.
854    pub style: *mut _xsltStylesheet,
855
856    /// Current template being executed.
857    pub templ: *mut _xsltTemplate,
858
859    /// Source document being transformed.
860    pub document: *mut _xmlDoc,
861
862    /// Current node in the source document.
863    pub node: *mut _xmlNode,
864
865    /// Current node list (for xsl:for-each context).
866    pub nodeList: *mut _xmlNode,
867
868    /// Context size (number of nodes in current node list).
869    pub contextSize: c_int,
870
871    /// Context position (1-based position in current node list).
872    pub proximityPosition: c_int,
873
874    /// XPath evaluation context.
875    pub xpathCtxt: *mut _xmlXPathContext,
876
877    /// XPath return value stack.
878    pub xpathReturn: *mut c_void,
879
880    pub xpathReturnNr: c_int,
881    pub xpathReturnMax: c_int,
882    pub xpathReturnTab: *mut c_void,
883
884    /// Template stack.
885    pub templNr: c_int,
886    pub templMax: c_int,
887    pub templTab: *mut *mut _xsltTemplate,
888
889    /// Current template recursion depth.
890    pub depth: c_int,
891
892    /// Maximum allowed template recursion depth.
893    pub maxDepth: c_int,
894
895    /// Variable stack.
896    pub varsNr: c_int,
897    pub varsMax: c_int,
898    pub varsBase: c_int,
899    pub varsTab: *mut c_void,
900
901    /// Parameter stack.
902    pub paramsNr: c_int,
903    pub paramsMax: c_int,
904    pub paramsBase: c_int,
905    pub paramsTab: *mut c_void,
906
907    /// Key tables (hash of xsltKeyTablePtr).
908    pub keyTables: *mut c_void,
909
910    /// Whether sorting is active.
911    pub hasSort: c_int,
912
913    /// Output buffer.
914    pub output: *mut _xmlOutputBuffer,
915
916    /// Error handler function.
917    pub errFunc: *mut c_void,
918
919    /// Error handler context.
920    pub errCtxt: *mut c_void,
921
922    /// Hash of extension data.
923    pub extInfos: *mut c_void,
924
925    pub extrasNr: c_int,
926    pub extrasMax: c_int,
927    pub extrasTab: *mut *mut c_void,
928
929    /// Current state flags.
930    pub state: c_int,
931
932    /// Template priority during matching.
933    pub priority: c_int,
934
935    /// Current parser context (for document() function).
936    pub parserCtxt: *mut _xmlParserCtxt,
937
938    /// Save flags.
939    pub save: c_int,
940
941    /// Options.
942    pub opts: c_int,
943
944    /// Security preferences.
945    pub secPrefs: *mut c_void,
946
947    /// Document cache for document() function.
948    pub docCache: *mut c_void,
949
950    /// Hash of global variable values.
951    pub globalVars: *mut c_void,
952
953    /// Profile data.
954    pub profile: *mut c_void,
955
956    /// Profile timer.
957    pub prof: c_long,
958
959    pub extFunctionsNr: c_int,
960    pub extFunctionsMax: c_int,
961    pub extFunctionsTab: *mut c_void,
962
963    /// User data pointer.
964    pub userData: *mut c_void,
965
966    /// Current stack frame.
967    pub frame: c_int,
968    pub frameNr: c_int,
969    pub frameMax: c_int,
970    pub frameTab: *mut c_void,
971
972    /// Current insertion point for result tree construction.
973    pub insert: *mut _xmlNode,
974
975    /// Current result document.
976    pub resultDoc: *mut _xmlDoc,
977
978    /// Namespace stack.
979    pub nsNr: c_int,
980    pub nsMax: c_int,
981    pub nsTab: *mut c_void,
982    pub nsNrOriginal: c_int,
983    pub nsMaxOriginal: c_int,
984    pub nsTabOriginal: *mut c_void,
985
986    /// Current template node.
987    pub currentTemplate: *mut _xmlNode,
988
989    /// Template lookup hash.
990    pub templHash: *mut c_void,
991
992    /// Original variable stack.
993    pub varsNrOriginal: c_int,
994    pub varsMaxOriginal: c_int,
995    pub varsTabOriginal: *mut c_void,
996
997    /// Insert depth (number of nested insertion points).
998    pub insertDepth: c_int,
999
1000    /// Maximum allowed insert depth.
1001    pub maxInsertDepth: c_int,
1002}
1003
1004/// XSLT compiled template.
1005///
1006/// # UPSTREAM-PARITY
1007///
1008/// Layout matches upstream `_xsltTemplate` from xsltInternals.h.
1009#[repr(C)]
1010pub struct _xsltTemplate {
1011    /// Next template in the list.
1012    pub next: *mut _xsltTemplate,
1013
1014    /// Owning stylesheet.
1015    pub style: *mut _xsltStylesheet,
1016
1017    /// Match pattern node (the `match` attribute expression).
1018    pub r#match: *mut _xmlNode,
1019
1020    /// Template name (for named templates).
1021    pub name: *const xmlChar,
1022
1023    /// Template mode.
1024    pub mode: *const xmlChar,
1025
1026    /// Template priority.
1027    pub priority: f64,
1028
1029    /// Template content (the child instruction nodes).
1030    pub content: *mut _xmlNode,
1031
1032    /// Import depth (0 = main stylesheet, 1+ = imported).
1033    pub depth: c_int,
1034
1035    /// Template flags.
1036    pub flags: c_int,
1037
1038    /// Number of inherited namespace declarations.
1039    pub inheritedNsNr: c_int,
1040
1041    /// Inherited namespace declarations.
1042    pub inheritedNs: *mut c_void,
1043}
1044
1045/// XSLT document wrapper.
1046///
1047/// # UPSTREAM-PARITY
1048///
1049/// Layout matches upstream `_xsltDocument` from xsltInternals.h.
1050#[repr(C)]
1051pub struct _xsltDocument {
1052    /// Next document in the list.
1053    pub next: *mut _xsltDocument,
1054
1055    /// Import depth.
1056    pub depth: c_int,
1057
1058    /// The wrapped document.
1059    pub doc: *mut _xmlDoc,
1060
1061    /// Insertion point for result tree construction.
1062    pub insert: *mut _xmlNode,
1063
1064    /// Owning stylesheet.
1065    pub style: *mut _xsltStylesheet,
1066
1067    /// Whether this is a compiled context.
1068    pub compCtxt: c_int,
1069}
1070
1071/// XSLT key definition.
1072///
1073/// # UPSTREAM-PARITY
1074///
1075/// Layout matches upstream `_xsltKeyDef` from xsltInternals.h.
1076#[repr(C)]
1077pub struct _xsltKeyDef {
1078    /// Next key definition.
1079    pub next: *mut _xsltKeyDef,
1080
1081    /// Owning stylesheet.
1082    pub style: *mut _xsltStylesheet,
1083
1084    /// The xsl:key instruction node.
1085    pub inst: *mut _xmlNode,
1086
1087    /// Key name.
1088    pub name: *const xmlChar,
1089
1090    /// Match pattern.
1091    pub r#match: *const xmlChar,
1092
1093    /// Use expression.
1094    pub r#use: *const xmlChar,
1095
1096    /// Import depth.
1097    pub depth: c_int,
1098}
1099
1100/// XSLT key table entry.
1101///
1102/// # UPSTREAM-PARITY
1103///
1104/// Layout matches upstream `_xsltKeyTable` from xsltInternals.h.
1105#[repr(C)]
1106pub struct _xsltKeyTable {
1107    /// Next key table.
1108    pub next: *mut _xsltKeyTable,
1109
1110    /// Table of XPath object results.
1111    pub table: *mut *mut _xmlXPathObject,
1112
1113    /// Number of entries in table.
1114    pub nb: c_int,
1115
1116    /// Maximum capacity of table.
1117    pub max: c_int,
1118
1119    /// Key name.
1120    pub name: *mut xmlChar,
1121
1122    /// Import depth.
1123    pub depth: c_int,
1124}
1125
1126/// XSLT stack element (variable/parameter binding).
1127///
1128/// # UPSTREAM-PARITY
1129///
1130/// Layout matches upstream `_xsltStackElem` from xsltInternals.h.
1131#[repr(C)]
1132pub struct _xsltStackElem {
1133    /// Next stack element.
1134    pub next: *mut _xsltStackElem,
1135
1136    /// Owning stylesheet.
1137    pub style: *mut _xsltStylesheet,
1138
1139    /// The xsl:variable or xsl:param instruction node.
1140    pub inst: *mut _xmlNode,
1141
1142    /// Variable/parameter name.
1143    pub name: *const xmlChar,
1144
1145    /// Variable/parameter namespace URI.
1146    pub nameURI: *const xmlChar,
1147
1148    /// Select expression.
1149    pub select: *const xmlChar,
1150
1151    /// Compiled select expression.
1152    pub comp: *mut _xmlXPathObject,
1153
1154    /// Tree content (for inline content).
1155    pub tree: *mut _xmlNode,
1156
1157    /// Evaluated value.
1158    pub value: *mut _xmlXPathObject,
1159
1160    /// Flags.
1161    pub flags: c_int,
1162
1163    /// Scope level.
1164    pub level: c_int,
1165
1166    /// Whether this is a compiled context.
1167    pub compCtxt: c_int,
1168}
1169
1170/// XSLT decimal format definition.
1171///
1172/// # UPSTREAM-PARITY
1173///
1174/// Layout matches upstream `_xsltDecimalFormat` from xsltInternals.h.
1175#[repr(C)]
1176pub struct _xsltDecimalFormat {
1177    /// Next decimal format.
1178    pub next: *mut _xsltDecimalFormat,
1179
1180    /// Format name (NULL = default).
1181    pub name: *const xmlChar,
1182
1183    /// Digit character.
1184    pub digit: *mut xmlChar,
1185
1186    /// Pattern separator character.
1187    pub patternSeparator: *mut xmlChar,
1188
1189    /// Decimal point character.
1190    pub decimalPoint: *mut xmlChar,
1191
1192    /// Grouping separator character.
1193    pub groupingSeparator: *mut xmlChar,
1194
1195    /// Infinity string.
1196    pub infinity: *mut xmlChar,
1197
1198    /// Minus sign character.
1199    pub minusSign: *mut xmlChar,
1200
1201    /// NaN string.
1202    pub NaN: *mut xmlChar,
1203
1204    /// Percent character.
1205    pub percent: *mut xmlChar,
1206
1207    /// Per-mille character.
1208    pub perMille: *mut xmlChar,
1209
1210    /// Zero digit character.
1211    pub zeroDigit: *mut xmlChar,
1212}
1213
1214/// XSLT namespace alias.
1215///
1216/// # UPSTREAM-PARITY
1217///
1218/// Layout matches upstream `_xsltNsAlias` from xsltInternals.h.
1219#[repr(C)]
1220pub struct _xsltNsAlias {
1221    /// Next namespace alias.
1222    pub next: *mut _xsltNsAlias,
1223
1224    /// Result namespace URI.
1225    pub resultNs: *const xmlChar,
1226
1227    /// Stylesheet namespace URI.
1228    pub styleNs: *const xmlChar,
1229}
1230
1231/// XSLT attribute set.
1232///
1233/// # UPSTREAM-PARITY
1234///
1235/// Layout matches upstream `_xsltAttrSet` from xsltInternals.h.
1236#[repr(C)]
1237pub struct _xsltAttrSet {
1238    /// Next attribute set.
1239    pub next: *mut _xsltAttrSet,
1240
1241    /// Attribute set name.
1242    pub name: *const xmlChar,
1243
1244    /// Attribute set namespace URI.
1245    pub ns: *const xmlChar,
1246
1247    /// The xsl:attribute-set instruction node.
1248    pub inst: *mut _xmlNode,
1249
1250    /// Owning stylesheet.
1251    pub style: *mut _xsltStylesheet,
1252
1253    /// Import depth.
1254    pub depth: c_int,
1255}
1256
1257/// XSLT sort element.
1258///
1259/// # UPSTREAM-PARITY
1260///
1261/// Layout matches upstream `_xsltSort` from xsltInternals.h.
1262#[repr(C)]
1263pub struct _xsltSort {
1264    /// Next sort element.
1265    pub next: *mut _xsltSort,
1266
1267    /// The xsl:sort instruction node.
1268    pub inst: *mut _xmlNode,
1269
1270    /// The sort key select expression.
1271    pub select: *const xmlChar,
1272
1273    /// Language for sorting.
1274    pub lang: *const xmlChar,
1275
1276    /// Data type ("text" or "number").
1277    pub dataType: *const xmlChar,
1278
1279    /// Sort order ("ascending" or "descending").
1280    pub order: *const xmlChar,
1281
1282    /// Case order ("upper-first" or "lower-first").
1283    pub caseOrder: *const xmlChar,
1284
1285    /// Whether this sort is a text sort.
1286    pub isText: c_int,
1287
1288    /// Whether the select expression was a constant.
1289    pub hasConst: c_int,
1290
1291    /// Locale information.
1292    pub locale: *mut c_void,
1293
1294    /// Owning stylesheet.
1295    pub style: *mut _xsltStylesheet,
1296
1297    /// Import depth.
1298    pub depth: c_int,
1299}
1300
1301// ── Type aliases for pointer types ──────────────────────────────────────
1302
1303pub type xmlNodePtr = *mut _xmlNode;
1304pub type xmlDocPtr = *mut _xmlDoc;
1305pub type xmlNsPtr = *mut _xmlNs;
1306pub type xmlAttrPtr = *mut _xmlAttr;
1307pub type xmlDtdPtr = *mut _xmlDtd;
1308pub type xmlEntityPtr = *mut _xmlEntity;
1309pub type xmlErrorPtr = *mut _xmlError;
1310pub type xmlParserCtxtPtr = *mut _xmlParserCtxt;
1311pub type xmlParserInputPtr = *mut _xmlParserInput;
1312pub type xmlParserInputBufferPtr = *mut _xmlParserInputBuffer;
1313pub type xmlOutputBufferPtr = *mut _xmlOutputBuffer;
1314pub type xmlSAXHandlerPtr = *mut _xmlSAXHandler;
1315pub type xmlValidCtxtPtr = *mut _xmlValidCtxt;
1316pub type xmlBufferPtr = *mut _xmlBuffer;
1317pub type xmlElementPtr = *mut _xmlElement;
1318pub type xmlElementContentPtr = *mut _xmlElementContent;
1319pub type xmlNotationPtr = *mut _xmlNotation;
1320pub type xmlEnumerationPtr = *mut _xmlEnumeration;
1321pub type xmlAttributeDeclPtr = *mut _xmlAttribute;
1322pub type xmlXPathContextPtr = *mut _xmlXPathContext;
1323pub type xmlXPathObjectPtr = *mut _xmlXPathObject;
1324pub type xmlNodeSetPtr = *mut _xmlNodeSet;
1325pub type xmlCharEncodingHandlerPtr = *mut _xmlCharEncodingHandler;
1326pub type xmlBufPtr = *mut _xmlBuf;
1327pub type xsltStylesheetPtr = *mut _xsltStylesheet;
1328pub type xsltTransformContextPtr = *mut _xsltTransformContext;
1329pub type xsltTemplatePtr = *mut _xsltTemplate;
1330pub type xsltKeyDefPtr = *mut _xsltKeyDef;
1331pub type xsltKeyTablePtr = *mut _xsltKeyTable;
1332pub type xsltStackElemPtr = *mut _xsltStackElem;
1333pub type xsltDecimalFormatPtr = *mut _xsltDecimalFormat;
1334pub type xsltNsAliasPtr = *mut _xsltNsAlias;
1335pub type xsltAttrSetPtr = *mut _xsltAttrSet;
1336pub type xsltDocumentPtr = *mut _xsltDocument;
1337pub type xsltSortPtr = *mut _xsltSort;