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///
128/// # ABI
129///
130/// Layout mirrors upstream `struct _xmlElement` (libxml2 2.15.x tree.h): the
131/// declaration is node-shaped (children/last/parent/next/prev/doc) even though
132/// it is stored in the DTD's element hash table. `cont_model` is the compiled
133/// content-model regexp built by `xmlValidBuildContentModel` and is opaque
134/// here (`xmlRegexp *` upstream).
135#[repr(C)]
136pub struct _xmlElement {
137 pub _private: *mut c_void, // application data
138 pub type_: c_int, // xmlElementType (XML_ELEMENT_DECL)
139 pub name: *const xmlChar, // Element name
140 pub children: *mut _xmlNode, // NULL
141 pub last: *mut _xmlNode, // NULL
142 pub parent: *mut _xmlDtd, // -> DTD
143 pub next: *mut _xmlNode, // next sibling (NULL for decls)
144 pub prev: *mut _xmlNode, // previous sibling (NULL for decls)
145 pub doc: *mut _xmlDoc, // containing document
146 pub etype: c_int, // xmlElementTypeVal
147 pub content: *mut _xmlElementContent, // Content model
148 pub attributes: *mut _xmlAttribute, // List of declared attributes
149 pub prefix: *const xmlChar, // Namespace prefix
150 pub cont_model: *mut c_void, // validating regexp (xmlRegexp *)
151}
152
153// ── xmlNs ───────────────────────────────────────────────────────────────
154//
155// Source: tree.h lines 501-512
156
157/// Namespace declaration or XPath namespace node.
158#[repr(C)]
159pub struct _xmlNs {
160 pub next: *mut _xmlNs, // Next namespace
161 pub type_: c_int, // XML_NAMESPACE_DECL
162 pub href: *const xmlChar, // Namespace URI
163 pub prefix: *const xmlChar, // Namespace prefix
164 pub _private: *mut c_void, // Application data
165 pub context: *mut _xmlDoc, // Normally an xmlDoc (deprecated)
166}
167
168// ── xmlDtd ──────────────────────────────────────────────────────────────
169//
170// Source: tree.h lines 538-564
171
172/// DTD (Document Type Definition).
173#[repr(C)]
174pub struct _xmlDtd {
175 pub _private: *mut c_void, // Application data
176 pub type_: c_int, // XML_DTD_NODE
177 pub name: *const xmlChar, // Name of the DTD
178 pub children: *mut _xmlNode, // First child
179 pub last: *mut _xmlNode, // Last child
180 pub parent: *mut _xmlDoc, // Parent node (document)
181 pub next: *mut _xmlNode, // Next sibling
182 pub prev: *mut _xmlNode, // Previous sibling
183 pub doc: *mut _xmlDoc, // Containing document
184 // End of common part
185 pub notations: *mut c_void, // Hash table for notations
186 pub elements: *mut c_void, // Hash table for elements
187 pub attributes: *mut c_void, // Hash table for attributes
188 pub entities: *mut c_void, // Hash table for entities
189 pub ExternalID: *mut xmlChar, // Public identifier
190 pub SystemID: *mut xmlChar, // System identifier
191 pub pentities: *mut c_void, // Hash table for parameter entities
192}
193
194// ── xmlAttr ─────────────────────────────────────────────────────────────
195//
196// Source: tree.h lines 595-615
197
198/// Attribute node.
199#[repr(C)]
200pub struct _xmlAttr {
201 pub _private: *mut c_void, // Application data
202 pub type_: c_int, // XML_ATTRIBUTE_NODE
203 pub name: *const xmlChar, // Local name
204 pub children: *mut _xmlNode, // First child (text value)
205 pub last: *mut _xmlNode, // Last child
206 pub parent: *mut _xmlNode, // Parent node
207 pub next: *mut _xmlAttr, // Next sibling (attribute)
208 pub prev: *mut _xmlAttr, // Previous sibling (attribute)
209 pub doc: *mut _xmlDoc, // Containing document
210 pub ns: *mut _xmlNs, // Namespace if any
211 pub atype: c_int, // Attribute type
212 pub psvi: *mut c_void, // Type/PSVI information
213 pub id: *mut c_void, // ID struct (deprecated)
214}
215
216// ── xmlNode ─────────────────────────────────────────────────────────────
217//
218// Source: tree.h lines 645-688
219
220/// XML node — the core tree structure.
221#[repr(C)]
222pub struct _xmlNode {
223 pub _private: *mut c_void, // Application data
224 pub type_: c_int, // Type enum
225 pub name: *const xmlChar, // Node name
226 pub children: *mut _xmlNode, // First child
227 pub last: *mut _xmlNode, // Last child
228 pub parent: *mut _xmlNode, // Parent node (NULL for documents)
229 pub next: *mut _xmlNode, // Next sibling
230 pub prev: *mut _xmlNode, // Previous sibling
231 pub doc: *mut _xmlDoc, // Associated document
232 // End of common part
233 pub ns: *mut _xmlNs, // Namespace of element
234 pub content: *mut xmlChar, // Content (text/comment/PI)
235 pub properties: *mut _xmlAttr, // First attribute of element
236 pub nsDef: *mut _xmlNs, // First namespace definition
237 pub psvi: *mut c_void, // Type/PSVI information
238 pub line: c_ushort, // Line number
239 pub extra: c_ushort, // Extra data for XPath/XSLT
240}
241
242// ── xmlDoc ──────────────────────────────────────────────────────────────
243//
244// Source: tree.h lines 787-845
245
246/// XML Document.
247#[repr(C)]
248pub struct _xmlDoc {
249 pub _private: *mut c_void, // Application data
250 pub type_: c_int, // XML_DOCUMENT_NODE or XML_HTML_DOCUMENT_NODE
251 pub name: *mut c_char, // NULL
252 pub children: *mut _xmlNode, // First child (root element)
253 pub last: *mut _xmlNode, // Last child
254 pub parent: *mut _xmlNode, // Parent node
255 pub next: *mut _xmlNode, // Next sibling
256 pub prev: *mut _xmlNode, // Previous sibling
257 pub doc: *mut _xmlDoc, // Reference to itself
258 // End of common part
259 pub compression: c_int, // Level of zlib compression
260 pub standalone: c_int, // Standalone document status
261 pub intSubset: *mut _xmlDtd, // Internal subset
262 pub extSubset: *mut _xmlDtd, // External subset
263 pub oldNs: *mut _xmlNs, // Old namespace (used during parsing)
264 pub version: *mut xmlChar, // Version string from XML declaration
265 pub encoding: *mut xmlChar, // Actual encoding
266 pub ids: *mut c_void, // Hash table for ID attributes
267 pub refs: *mut c_void, // Hash table for IDREFs (deprecated)
268 pub URL: *mut xmlChar, // URI of the document
269 pub charset: c_int, // Unused (encoding indicator)
270 pub dict: *mut c_void, // Dictionary for names (opaque _xmlDict)
271 pub psvi: *mut c_void, // Type/PSVI information
272 pub parseFlags: c_int, // Parser options used
273 pub properties: c_int, // Document properties flags
274}
275
276// ── xmlEntity ───────────────────────────────────────────────────────────
277//
278// Source: entities.h lines 42-74
279
280/// Entity declaration.
281#[repr(C)]
282pub struct _xmlEntity {
283 pub _private: *mut c_void, // Application data
284 pub type_: c_int, // XML_ENTITY_DECL (must be second!)
285 pub name: *const xmlChar, // Entity name
286 pub children: *mut _xmlNode, // First child link
287 pub last: *mut _xmlNode, // Last child link
288 pub parent: *mut _xmlDtd, // -> DTD
289 pub next: *mut _xmlNode, // Next sibling link
290 pub prev: *mut _xmlNode, // Previous sibling link
291 pub doc: *mut _xmlDoc, // The containing document
292 pub orig: *mut xmlChar, // Content without ref substitution
293 pub content: *mut xmlChar, // Content or ndata if unparsed
294 pub length: c_int, // The content length
295 pub etype: c_int, // The entity type
296 pub ExternalID: *const xmlChar, // External identifier for PUBLIC
297 pub SystemID: *const xmlChar, // URI for SYSTEM or PUBLIC Entity
298 pub nexte: *mut _xmlEntity, // Unused
299 pub URI: *const xmlChar, // The full URI as computed
300 pub owner: c_int, // Unused
301 pub flags: c_int, // Various flags
302 pub expandedSize: c_ulong, // Expanded size
303}
304
305// ── xmlError ────────────────────────────────────────────────────────────
306//
307// Source: xmlerror.h
308
309/// Structured error information.
310#[repr(C)]
311pub struct _xmlError {
312 pub domain: c_int, // Error domain
313 pub code: c_int, // Error code
314 pub message: *mut c_char, // Human-readable error message
315 pub level: c_int, // Error level
316 pub file: *mut c_char, // Filename if available
317 pub line: c_int, // Line number if available
318 pub str1: *mut c_char, // Extra string information
319 pub str2: *mut c_char, // Extra string information
320 pub str3: *mut c_char, // Extra string information
321 pub int1: c_int, // Extra number information
322 pub int2: c_int, // Column number if available
323 pub ctxt: *mut c_void, // Parser context if available
324 pub node: *mut c_void, // Node if available
325}
326
327// ── xmlParserInput ──────────────────────────────────────────────────────
328//
329// Source: parser.h
330
331/// Parser input stream.
332#[repr(C)]
333pub struct _xmlParserInput {
334 pub buf: *mut _xmlParserInputBuffer, // Input buffer (deprecated)
335 pub filename: *const c_char, // The filename or URI (deprecated)
336 pub directory: *const c_char, // Unused (deprecated)
337 pub base: *const xmlChar, // Base of the array to parse
338 pub cur: *const xmlChar, // Current char being parsed (deprecated)
339 pub end: *const xmlChar, // End of the array to parse
340 pub length: c_int, // Unused (deprecated)
341 pub line: c_int, // Current line (deprecated)
342 pub col: c_int, // Current column (deprecated)
343 pub consumed: c_ulong, // How many xmlChars consumed (deprecated)
344 pub free: Option<unsafe extern "C" fn(*mut c_char)>, // Deallocation func (deprecated)
345 pub encoding: *const xmlChar, // Unused (deprecated)
346 pub version: *const xmlChar, // The version string for entity (deprecated)
347 pub flags: c_int, // Flags (deprecated)
348 pub id: c_int, // Unique identifier (deprecated)
349 pub parentConsumed: c_ulong, // Unused (deprecated)
350 pub entity: *mut _xmlEntity, // Entity if any (deprecated)
351}
352
353// ── xmlParserInputBuffer ────────────────────────────────────────────────
354//
355// Source: xmlIO.h
356
357/// Parser input buffer.
358#[repr(C)]
359pub struct _xmlParserInputBuffer {
360 pub context: *mut c_void, // (deprecated)
361 pub readcallback: Option<xmlInputReadCallback>, // (deprecated)
362 pub closecallback: Option<xmlInputCloseCallback>, // (deprecated)
363 pub encoder: *mut c_void, // I18N converter (deprecated)
364 pub buffer: *mut c_void, // Local buffer (deprecated)
365 pub raw: *mut c_void, // Raw input buffer (deprecated)
366 pub compressed: c_int, // Compression flag (deprecated)
367 pub error: c_int, // (deprecated)
368 pub rawconsumed: c_ulong, // (deprecated)
369}
370
371// ── xmlOutputBuffer ─────────────────────────────────────────────────────
372//
373// Source: xmlIO.h
374
375/// Output buffer.
376#[repr(C)]
377pub struct _xmlOutputBuffer {
378 pub context: *mut c_void, // (deprecated)
379 pub writecallback: Option<xmlOutputWriteCallback>, // (deprecated)
380 pub closecallback: Option<xmlOutputCloseCallback>, // (deprecated)
381 pub encoder: *mut c_void, // I18N converter
382 pub buffer: *mut c_void, // Local buffer
383 pub conv: *mut c_void, // Output conversion buffer
384 pub written: c_int, // Total bytes written
385 pub error: c_int, // Error flag
386}
387
388// ── xmlCharEncodingHandler ───────────────────────────────────────────────
389//
390// Source: encoding.h
391
392/// Character encoding conversion handler.
393///
394/// # UPSTREAM-PARITY
395///
396/// Layout matches upstream `encoding.h` `struct _xmlCharEncodingHandler`
397/// (2.15.x): `name`, then two anonymous unions (`input`, `output`) each
398/// carrying either a modern `xmlCharEncConvFunc` or a legacy
399/// `xmlCharEncodingInputFunc`/`xmlCharEncodingOutputFunc`, then
400/// `inputCtxt`, `outputCtxt`, `ctxtDtor`, `flags`.
401/// sizeof == 56, _Alignof == 8 on x86-64.
402#[repr(C)]
403pub union EncodingInputUnion {
404 pub func: Option<xmlCharEncConvFunc>,
405 pub legacyFunc: Option<xmlCharEncodingInputFunc>,
406}
407
408/// Output-side counterpart of [`EncodingInputUnion`].
409#[repr(C)]
410pub union EncodingOutputUnion {
411 pub func: Option<xmlCharEncConvFunc>,
412 pub legacyFunc: Option<xmlCharEncodingOutputFunc>,
413}
414
415/// Character encoding conversion handler.
416#[repr(C)]
417pub struct _xmlCharEncodingHandler {
418 pub name: *mut c_char, // Encoding name
419 pub input: EncodingInputUnion, // Input converter (union)
420 pub output: EncodingOutputUnion, // Output converter (union)
421 pub inputCtxt: *mut c_void, // Iconv context for input
422 pub outputCtxt: *mut c_void, // Iconv context for output
423 pub ctxtDtor: Option<xmlCharEncConvCtxtDtor>, // Context destructor
424 pub flags: c_int, // xmlCharEncFlags
425}
426
427// ── xmlBuf ──────────────────────────────────────────────────────────────
428//
429// Source: tree.h
430
431/// Buffer structure (modern replacement for xmlBuffer).
432#[repr(C)]
433pub struct _xmlBuf {
434 pub content: *mut xmlChar, // The buffer content UTF8
435 pub use_: c_uint, // The buffer size used
436 pub size: c_uint, // The buffer size
437 pub alloc: c_int, // The realloc method
438 pub error: c_int, // Error flag
439 pub buffer: c_int, // Is this a buffer from xmlBuffer?
440 pub io: c_int, // In IO mode?
441}
442
443// ── xmlSAXHandler ───────────────────────────────────────────────────────
444//
445// Source: parser.h
446
447/// SAX event handler structure.
448#[repr(C)]
449pub struct _xmlSAXHandler {
450 pub internalSubset: Option<internalSubsetSAXFunc>,
451 pub isStandalone: Option<isStandaloneSAXFunc>,
452 pub hasInternalSubset: Option<hasInternalSubsetSAXFunc>,
453 pub hasExternalSubset: Option<hasExternalSubsetSAXFunc>,
454 pub resolveEntity: Option<resolveEntitySAXFunc>,
455 pub getEntity: Option<getEntitySAXFunc>,
456 pub entityDecl: Option<entityDeclSAXFunc>,
457 pub notationDecl: Option<notationDeclSAXFunc>,
458 pub attributeDecl: Option<attributeDeclSAXFunc>,
459 pub elementDecl: Option<elementDeclSAXFunc>,
460 pub unparsedEntityDecl: Option<unparsedEntityDeclSAXFunc>,
461 pub setDocumentLocator: Option<setDocumentLocatorSAXFunc>,
462 pub startDocument: Option<startDocumentSAXFunc>,
463 pub endDocument: Option<endDocumentSAXFunc>,
464 pub startElement: Option<startElementSAXFunc>,
465 pub endElement: Option<endElementSAXFunc>,
466 pub reference: Option<referenceSAXFunc>,
467 pub characters: Option<charactersSAXFunc>,
468 pub ignorableWhitespace: Option<ignorableWhitespaceSAXFunc>,
469 pub processingInstruction: Option<processingInstructionSAXFunc>,
470 pub comment: Option<commentSAXFunc>,
471 pub warning: Option<warningSAXFunc>,
472 pub error: Option<errorSAXFunc>,
473 pub fatalError: Option<fatalErrorSAXFunc>,
474 pub getParameterEntity: Option<getParameterEntitySAXFunc>,
475 pub cdataBlock: Option<cdataBlockSAXFunc>,
476 pub externalSubset: Option<externalSubsetSAXFunc>,
477 pub initialized: c_uint,
478 pub _private: *mut c_void,
479 pub startElementNs: Option<startElementNsSAX2Func>,
480 pub endElementNs: Option<endElementNsSAX2Func>,
481 pub serror: Option<xmlStructuredErrorFunc>,
482}
483
484/// SAX handler, version 1 (upstream `struct _xmlSAXHandlerV1`, parser.h).
485///
486/// # ABI
487///
488/// Exactly the first 28 fields of `_xmlSAXHandler`; this is the type of the
489/// deprecated exported consts `xmlDefaultSAXHandler` / `htmlDefaultSAXHandler`.
490#[repr(C)]
491pub struct _xmlSAXHandlerV1 {
492 pub internalSubset: Option<internalSubsetSAXFunc>,
493 pub isStandalone: Option<isStandaloneSAXFunc>,
494 pub hasInternalSubset: Option<hasInternalSubsetSAXFunc>,
495 pub hasExternalSubset: Option<hasExternalSubsetSAXFunc>,
496 pub resolveEntity: Option<resolveEntitySAXFunc>,
497 pub getEntity: Option<getEntitySAXFunc>,
498 pub entityDecl: Option<entityDeclSAXFunc>,
499 pub notationDecl: Option<notationDeclSAXFunc>,
500 pub attributeDecl: Option<attributeDeclSAXFunc>,
501 pub elementDecl: Option<elementDeclSAXFunc>,
502 pub unparsedEntityDecl: Option<unparsedEntityDeclSAXFunc>,
503 pub setDocumentLocator: Option<setDocumentLocatorSAXFunc>,
504 pub startDocument: Option<startDocumentSAXFunc>,
505 pub endDocument: Option<endDocumentSAXFunc>,
506 pub startElement: Option<startElementSAXFunc>,
507 pub endElement: Option<endElementSAXFunc>,
508 pub reference: Option<referenceSAXFunc>,
509 pub characters: Option<charactersSAXFunc>,
510 pub ignorableWhitespace: Option<ignorableWhitespaceSAXFunc>,
511 pub processingInstruction: Option<processingInstructionSAXFunc>,
512 pub comment: Option<commentSAXFunc>,
513 pub warning: Option<warningSAXFunc>,
514 pub error: Option<errorSAXFunc>,
515 pub fatalError: Option<fatalErrorSAXFunc>,
516 pub getParameterEntity: Option<getParameterEntitySAXFunc>,
517 pub cdataBlock: Option<cdataBlockSAXFunc>,
518 pub externalSubset: Option<externalSubsetSAXFunc>,
519 pub initialized: c_uint,
520}
521
522/// Character-range table entry (upstream `xmlChSRange`, chvalid.h).
523#[repr(C)]
524pub struct xmlChSRange {
525 pub low: c_ushort,
526 pub high: c_ushort,
527}
528
529/// Long character-range table entry (upstream `xmlChLRange`, chvalid.h).
530#[repr(C)]
531pub struct xmlChLRange {
532 pub low: c_uint,
533 pub high: c_uint,
534}
535
536/// Character-class range group (upstream `xmlChRangeGroup`, chvalid.h) — the
537/// type of the exported char-class tables `xmlIsBaseCharGroup` &c.
538#[repr(C)]
539pub struct xmlChRangeGroup {
540 pub nbShortRange: c_int,
541 pub nbLongRange: c_int,
542 pub shortRange: *const xmlChSRange,
543 pub longRange: *const xmlChLRange,
544}
545
546// SAFETY: the group's raw pointers reference immutable `#[no_mangle]` const
547// arrays (generated from upstream data); they are never mutated, so the type
548// is safe to share across threads — required for the exported `static` tables
549// (upstream declares them `const`).
550unsafe impl Sync for xmlChRangeGroup {}
551
552// ── xmlParserCtxt ───────────────────────────────────────────────────────
553//
554// Source: parser.h
555
556/// Parser context — the primary parsing state structure.
557#[repr(C)]
558pub struct _xmlParserCtxt {
559 pub sax: *mut _xmlSAXHandler, // SAX handler (deprecated)
560 pub userData: *mut c_void, // User data (deprecated)
561 pub myDoc: *mut _xmlDoc, // Document being built (deprecated)
562 pub wellFormed: c_int, // Is document well formed? (deprecated)
563 pub replaceEntities: c_int, // Replace entities? (deprecated)
564 pub version: *mut xmlChar, // XML version string (deprecated)
565 pub encoding: *mut xmlChar, // Declared encoding (deprecated)
566 pub standalone: c_int, // Standalone document (deprecated)
567 pub html: c_int, // HTML document (deprecated)
568 // Input stream stack
569 pub input: *mut _xmlParserInput, // Current input stream
570 pub inputNr: c_int, // Number of current input streams
571 pub inputMax: c_int, // Max number of input streams (deprecated)
572 pub inputTab: *mut *mut _xmlParserInput, // Stack of inputs
573 // Node analysis stack
574 pub node: *mut _xmlNode, // Current element (deprecated)
575 pub nodeNr: c_int, // Depth of parsing stack (deprecated)
576 pub nodeMax: c_int, // Max depth (deprecated)
577 pub nodeTab: *mut *mut _xmlNode, // Array of nodes (deprecated)
578 // Node info
579 pub record_info: c_int, // Whether node info should be kept
580 pub node_seq: xmlParserNodeInfoSeq, // Info about each node parsed (deprecated)
581 // Error
582 pub errNo: c_int, // Error code (deprecated)
583 // Reference and external subset
584 pub hasExternalSubset: c_int, // (deprecated)
585 pub hasPErefs: c_int, // (deprecated)
586 pub external: c_int, // (deprecated)
587 pub valid: c_int, // Is document valid? (deprecated)
588 pub validate: c_int, // Validate flag (deprecated)
589 pub vctxt: _xmlValidCtxt, // Validity context
590 // Push parser state
591 pub instate: c_int, // (deprecated)
592 pub token: c_int, // (deprecated)
593 pub directory: *mut c_char, // Document directory (deprecated)
594 // Node name stack
595 pub name: *const xmlChar, // Current parsed Node (deprecated)
596 pub nameNr: c_int, // (deprecated)
597 pub nameMax: c_int, // (deprecated)
598 pub nameTab: *mut *const xmlChar, // (deprecated)
599 // Misc
600 pub nbChars: c_long, // (deprecated)
601 pub checkIndex: c_long, // (deprecated)
602 pub keepBlanks: c_int, // (deprecated)
603 pub disableSAX: c_int, // (deprecated)
604 pub inSubset: c_int, // DTD parsing state (deprecated)
605 pub intSubName: *const xmlChar, // Internal subset name (deprecated)
606 pub extSubURI: *mut xmlChar, // External subset URI (deprecated)
607 pub extSubSystem: *mut xmlChar, // External subset public ID (deprecated)
608 // xml:space values
609 pub space: *mut c_int, // (deprecated)
610 pub spaceNr: c_int, // (deprecated)
611 pub spaceMax: c_int, // (deprecated)
612 pub spaceTab: *mut c_int, // (deprecated)
613 // Entity loop prevention
614 pub depth: c_int, // (deprecated)
615 pub entity: *mut _xmlParserInput, // (deprecated)
616 pub charset: c_int, // (deprecated)
617 pub nodelen: c_int, // (deprecated)
618 pub nodemem: c_int, // (deprecated)
619 pub pedantic: c_int, // (deprecated)
620 pub _private: *mut c_void, // User data (deprecated)
621 pub loadsubset: c_int, // Load external subset (deprecated)
622 pub linenumbers: c_int, // (deprecated)
623 pub catalogs: *mut c_void, // (deprecated)
624 pub recovery: c_int, // Recovery mode (deprecated)
625 pub progressive: c_int, // (deprecated)
626 pub dict: *mut c_void, // Dictionary (deprecated)
627 pub atts: *mut *const xmlChar, // Attributes array (deprecated)
628 pub maxatts: c_int, // (deprecated)
629 pub docdict: c_int, // (deprecated)
630 // Pre-interned strings
631 pub str_xml: *const xmlChar, // (deprecated)
632 pub str_xmlns: *const xmlChar, // (deprecated)
633 pub str_xml_ns: *const xmlChar, // (deprecated)
634 // New SAX mode
635 pub sax2: c_int, // (deprecated)
636 pub nsNr: c_int, // (deprecated)
637 pub nsMax: c_int, // (deprecated)
638 pub nsTab: *mut *const xmlChar, // (deprecated)
639 pub attallocs: *mut c_uint, // (deprecated)
640 pub pushTab: *mut c_void, // xmlStartTag (deprecated)
641 pub attsDefault: *mut c_void, // (deprecated)
642 pub attsSpecial: *mut c_void, // (deprecated)
643 pub nsWellFormed: c_int, // (deprecated)
644 pub options: c_int, // Extra options (deprecated)
645 pub dictNames: c_int, // (deprecated)
646 // Streaming
647 pub freeElemsNr: c_int, // (deprecated)
648 pub freeElems: *mut _xmlNode, // (deprecated)
649 pub freeAttrsNr: c_int, // (deprecated)
650 pub freeAttrs: *mut _xmlAttr, // (deprecated)
651 pub lastError: _xmlError, // Last error info (deprecated)
652 pub parseMode: c_int, // (deprecated)
653 pub nbentities: c_ulong, // (deprecated)
654 pub sizeentities: c_ulong, // (deprecated)
655 // HTML non-recursive parser
656 pub nodeInfo: *mut c_void, // (deprecated)
657 pub nodeInfoNr: c_int, // (deprecated)
658 pub nodeInfoMax: c_int, // (deprecated)
659 pub nodeInfoTab: *mut c_void, // (deprecated)
660 pub input_id: c_int, // (deprecated)
661 pub sizeentcopy: c_ulong, // (deprecated)
662 pub endCheckState: c_int, // (deprecated)
663 pub nbErrors: c_ushort, // (deprecated)
664 pub nbWarnings: c_ushort, // (deprecated)
665 pub maxAmpl: c_uint, // (deprecated)
666 // Namespace database
667 pub nsdb: *mut c_void, // (deprecated)
668 pub attrHashMax: c_uint, // (deprecated)
669 pub attrHash: *mut c_void, // (deprecated)
670 // Error handler
671 pub errorHandler: Option<xmlStructuredErrorFunc>, // (deprecated)
672 pub errorCtxt: *mut c_void, // (deprecated)
673 // Resource loader
674 pub resourceLoader: Option<xmlResourceLoader>, // (deprecated)
675 pub resourceCtxt: *mut c_void, // (deprecated)
676 // Encoding conversion
677 pub convImpl: Option<xmlCharEncConvImpl>, // (deprecated)
678 pub convCtxt: *mut c_void, // (deprecated)
679}
680
681// ── xmlValidCtxt ────────────────────────────────────────────────────────
682//
683// Source: valid.h
684
685/// Validation context.
686#[repr(C)]
687pub struct _xmlValidCtxt {
688 pub userData: *mut c_void, // User specific data
689 pub error: Option<xmlValidityErrorFunc>, // Error callback
690 pub warning: Option<xmlValidityWarningFunc>, // Warning callback
691 pub node: *mut _xmlNode, // Current parsed Node
692 pub nodeNr: c_int, // Depth of the parsing stack
693 pub nodeMax: c_int, // Max depth
694 pub nodeTab: *mut *mut _xmlNode, // Array of nodes
695 pub flags: c_uint, // Internal flags
696 pub doc: *mut _xmlDoc, // The document
697 pub valid: c_int, // Temporary validity check result
698 pub vstate: *mut c_void, // Current validation state
699 pub vstateNr: c_int, // Depth of validation stack
700 pub vstateMax: c_int, // Max depth
701 pub vstateTab: *mut c_void, // Array of validation states
702 pub am: *mut c_void, // Automata
703 pub state: *mut c_void, // Automata state
704}
705
706// ── xmlID / xmlRef (valid.h ID/IDREF table entries) ────────────────────
707//
708// Source: tree.h `struct _xmlID` / `struct _xmlRef` (opaque upstream).
709
710/// An XML ID instance (ID table entry).
711#[repr(C)]
712pub struct _xmlID {
713 pub next: *mut _xmlID, // next ID
714 pub value: *mut xmlChar, // The ID name
715 pub attr: *mut _xmlAttr, // The attribute holding it
716 pub name: *const xmlChar, // The attribute if attr is not available
717 pub lineno: c_int, // The line number if attr is not available
718 pub doc: *mut _xmlDoc, // The document holding the ID
719}
720
721/// An XML IDREF instance (ref table entry).
722#[repr(C)]
723pub struct _xmlRef {
724 pub next: *mut _xmlRef, // next Ref
725 pub value: *const xmlChar, // The Ref name
726 pub attr: *mut _xmlAttr, // The attribute holding it
727 pub name: *const xmlChar, // The attribute if attr is not available
728 pub lineno: c_int, // The line number if attr is not available
729}
730
731// ── xmlParserNodeInfo ───────────────────────────────────────────────────
732
733/// Node info for parser tracking.
734#[repr(C)]
735pub struct _xmlParserNodeInfo {
736 pub node: *const _xmlNode,
737 pub begin_pos: c_ulong,
738 pub begin_line: c_ulong,
739 pub end_pos: c_ulong,
740 pub end_line: c_ulong,
741}
742
743/// Node info sequence.
744#[repr(C)]
745pub struct _xmlParserNodeInfoSeq {
746 pub block: *mut _xmlParserNodeInfo,
747 pub index: *mut c_int,
748 pub block_max: c_int,
749 pub size: c_int,
750}
751
752/// Typedef alias for `_xmlParserNodeInfoSeq`.
753pub type xmlParserNodeInfoSeq = _xmlParserNodeInfoSeq;
754
755// ── xmlXPathContext ─────────────────────────────────────────────────────
756//
757// Source: xpath.h
758
759/// XPath evaluation context.
760#[repr(C)]
761pub struct _xmlXPathContext {
762 pub doc: *mut _xmlDoc, // The current document
763 pub node: *mut _xmlNode, // The current node
764 pub nb_variables_unused: c_int, // (unused)
765 pub max_variables_unused: c_int, // (unused)
766 pub varHash: *mut c_void, // Hash table of defined variables
767 pub nb_types: c_int, // Number of defined types
768 pub max_types: c_int, // Max number of types
769 pub types: *mut c_void, // Array of defined types (xmlXPathType)
770 pub nb_funcs_unused: c_int, // (unused)
771 pub max_funcs_unused: c_int, // (unused)
772 pub funcHash: *mut c_void, // Hash table of defined funcs
773 pub nb_axis: c_int, // Number of defined axis
774 pub max_axis: c_int, // Max number of axis
775 pub axis: *mut c_void, // Array of defined axis (xmlXPathAxis)
776 pub namespaces: *mut *mut _xmlNs, // Array of namespaces
777 pub nsNr: c_int, // Number of namespaces in scope
778 pub user: *mut c_void, // Function to free
779 pub contextSize: c_int, // Context size
780 pub proximityPosition: c_int, // Proximity position
781 pub xptr: c_int, // XPointer context?
782 pub here: *mut _xmlNode, // For here()
783 pub origin: *mut _xmlNode, // For origin()
784 pub nsHash: *mut c_void, // Namespaces hash table
785 pub varLookupFunc: Option<xmlXPathVariableLookupFunc>, // Variable lookup func
786 pub varLookupData: *mut c_void, // Variable lookup data
787 pub extra: *mut c_void, // Needed for XSLT
788 pub function: *const xmlChar, // Function name when calling a function
789 pub functionURI: *const xmlChar, // Function namespace URI
790 pub funcLookupFunc: Option<xmlXPathFuncLookupFunc>, // Function lookup func
791 pub funcLookupData: *mut c_void, // Function lookup data
792 pub tmpNsList: *mut *mut _xmlNs, // Array of temp namespaces
793 pub tmpNsNr: c_int, // Number of temp namespaces
794 pub userData: *mut c_void, // User specific data
795 pub error: Option<xmlStructuredErrorFunc>, // Error callback
796 pub lastError: _xmlError, // Last error
797 pub debugNode: *mut _xmlNode, // Source node (XSLT)
798 pub dict: *mut c_void, // Dictionary
799 pub flags: c_int, // Compilation flags
800 pub cache: *mut c_void, // Cache for XPath objects
801 pub opLimit: c_ulong, // Resource limits
802 pub opCount: c_ulong,
803 pub depth: c_int,
804}
805
806// ── xmlXPathObject ──────────────────────────────────────────────────────
807//
808// Source: xpath.h
809
810/// XPath evaluated object.
811#[repr(C)]
812pub struct _xmlXPathObject {
813 pub type_: c_int, // Object type
814 pub nodesetval: *mut c_void, // Node set (xmlNodeSet)
815 pub boolval: c_int, // Boolean value
816 pub floatval: f64, // Number value
817 pub stringval: *mut xmlChar, // String value
818 pub user: *mut c_void, // User pointer
819 pub index: c_int, // Index
820 pub user2: *mut c_void, // User pointer 2
821 pub index2: c_int, // Index 2
822}
823
824// ── Node set (contained within XPath objects) ───────────────────────────
825
826/// XPath node set.
827#[repr(C)]
828pub struct _xmlNodeSet {
829 pub nodeNr: c_int, // Number of nodes
830 pub nodeMax: c_int, // Max number of nodes
831 pub nodeTab: *mut *mut _xmlNode, // Array of nodes
832}
833
834// ── XSLT types ──────────────────────────────────────────────────────────
835//
836// ═══════════════════════════════════════════════════════════════════════════════
837// XSLT Types (Phase 8)
838// ═══════════════════════════════════════════════════════════════════════════════
839// Source: xslt.h, xsltInternals.h (from libxslt)
840
841/// XSLT stylesheet — the compiled representation of an XSLT stylesheet.
842///
843/// # UPSTREAM-PARITY
844///
845/// Layout matches upstream `_xsltStylesheet` from xsltInternals.h (libxslt 1.1.39).
846/// Field order and types match the C struct exactly for ABI compatibility.
847///
848/// Courts: XSLT-STYLESHEET-*
849#[repr(C)]
850/// XSLT stylesheet (compiled).
851///
852/// # ABI
853///
854/// Layout mirrors upstream `struct _xsltStylesheet` (libxslt 1.1.42
855/// xsltInternals.h, verbatim in include/libxslt/xsltInternals.h). Verified by
856/// the RUST-MIRROR-ABI court (tools/abi/rust_mirror_court.py).
857#[repr(C)]
858pub struct _xsltStylesheet {
859 pub parent: *mut _xsltStylesheet, // parent stylesheet (imports)
860 pub next: *mut _xsltStylesheet, // next stylesheet in imports
861 pub imports: *mut _xsltStylesheet, // list of imported stylesheets
862 pub docList: *mut _xsltDocument, // documents of this stylesheet
863 pub doc: *mut _xmlDoc, // the stylesheet document
864 pub stripSpaces: *mut c_void, // xmlHashTablePtr: elements to strip
865 pub stripAll: c_int, // strip all whitespace
866 pub cdataSection: *mut c_void, // xmlHashTablePtr
867 pub variables: *mut _xsltStackElem, // global variables/params (list)
868 pub templates: *mut _xsltTemplate, // ordered templates (highest first)
869 pub templatesHash: *mut c_void, // xmlHashTablePtr: template lookup
870 pub rootMatch: *mut c_void, // xsltCompMatchPtr
871 pub keyMatch: *mut c_void,
872 pub elemMatch: *mut c_void,
873 pub attrMatch: *mut c_void,
874 pub parentMatch: *mut c_void,
875 pub textMatch: *mut c_void,
876 pub piMatch: *mut c_void,
877 pub commentMatch: *mut c_void,
878 pub nsAliases: *mut c_void, // xmlHashTablePtr
879 pub attributeSets: *mut c_void, // xmlHashTablePtr
880 pub nsHash: *mut c_void, // xmlHashTablePtr
881 pub nsDefs: *mut c_void,
882 pub keys: *mut c_void, // void *: key definitions
883 pub method: *mut xmlChar, // output method
884 pub methodURI: *mut xmlChar,
885 pub version: *mut xmlChar,
886 pub encoding: *mut xmlChar,
887 pub omitXmlDeclaration: c_int,
888 pub decimalFormat: *mut _xsltDecimalFormat, // xsltDecimalFormatPtr
889 pub standalone: c_int,
890 pub doctypePublic: *mut xmlChar,
891 pub doctypeSystem: *mut xmlChar,
892 pub indent: c_int,
893 pub mediaType: *mut xmlChar,
894 pub preComps: *mut c_void, // xsltElemPreCompPtr
895 pub warnings: c_int,
896 pub errors: c_int,
897 pub exclPrefix: *mut xmlChar,
898 pub exclPrefixTab: *mut *mut xmlChar,
899 pub exclPrefixNr: c_int,
900 pub exclPrefixMax: c_int,
901 pub _private: *mut c_void,
902 pub extInfos: *mut c_void, // xmlHashTablePtr
903 pub extrasNr: c_int,
904 pub includes: *mut _xsltDocument, // xsltDocumentPtr
905 pub dict: *mut c_void, // xmlDictPtr
906 pub attVTs: *mut c_void,
907 pub defaultAlias: *const xmlChar,
908 pub nopreproc: c_int,
909 pub internalized: c_int,
910 pub literal_result: c_int,
911 pub principal: *mut _xsltStylesheet, // xsltStylesheetPtr
912 // UPSTREAM-PARITY: `compCtxt` and `principalData` sit inside
913 // `#ifdef XSLT_REFACTORED` in xsltInternals.h and are absent from the
914 // oracle layout (system libxslt 1.1.45 ships with XSLT_REFACTORED
915 // disabled; verified against the installed xsltInternals.h). The mirror
916 // intentionally omits them so field offsets match the oracle DSO.
917 pub forwards_compatible: c_int,
918 pub namedTemplates: *mut c_void, // xmlHashTablePtr
919 pub xpathCtxt: *mut _xmlXPathContext, // xmlXPathContextPtr
920 pub opLimit: c_ulong,
921 pub opCount: c_ulong,
922}
923
924/// XSLT transform context — runtime state during a transformation.
925///
926/// # ABI
927///
928/// Layout mirrors upstream `struct _xsltTransformContext` (libxslt 1.1.42
929/// xsltInternals.h). The runtime keeps the XPath value stack on
930/// `xpathCtxt->value*` (upstream behaviour); there is no separate return
931/// stack in the context.
932#[repr(C)]
933pub struct _xsltTransformContext {
934 pub style: *mut _xsltStylesheet, // stylesheet being applied
935 pub type_: c_int, // xsltOutputType
936 pub templ: *mut _xsltTemplate, // current template
937 pub templNr: c_int,
938 pub templMax: c_int,
939 pub templTab: *mut *mut _xsltTemplate, // xsltTemplatePtr *
940 pub vars: *mut _xsltStackElem, // current variable stack head
941 pub varsNr: c_int,
942 pub varsMax: c_int,
943 pub varsTab: *mut *mut _xsltStackElem, // xsltStackElemPtr *
944 pub varsBase: c_int,
945 pub extFunctions: *mut c_void, // xmlHashTablePtr
946 pub extElements: *mut c_void, // xmlHashTablePtr
947 pub extInfos: *mut c_void, // xmlHashTablePtr
948 pub mode: *const xmlChar,
949 pub modeURI: *const xmlChar,
950 pub docList: *mut _xsltDocument, // xsltDocumentPtr
951 pub document: *mut _xsltDocument, // xsltDocumentPtr (current doc)
952 pub node: *mut _xmlNode, // current source node
953 pub nodeList: *mut _xmlNodeSet, // xmlNodeSetPtr
954 pub output: *mut _xmlDoc, // current result document
955 pub insert: *mut _xmlNode, // insertion point
956 pub xpathCtxt: *mut _xmlXPathContext, // xmlXPathContextPtr
957 pub state: c_int, // xsltTransformState
958 pub globalVars: *mut c_void, // xmlHashTablePtr
959 pub inst: *mut _xmlNode, // current instruction node
960 pub xinclude: c_int,
961 pub outputFile: *const c_char, // const char *
962 pub profile: c_int,
963 pub prof: c_long,
964 pub profNr: c_int,
965 pub profMax: c_int,
966 pub profTab: *mut c_long, // long *
967 pub _private: *mut c_void,
968 pub extrasNr: c_int,
969 pub extrasMax: c_int,
970 pub extras: *mut c_void, // xsltRuntimeExtraPtr
971 pub styleList: *mut _xsltDocument, // xsltDocumentPtr
972 pub sec: *mut c_void, // xsltSecurityPrefsPtr
973 pub error: Option<xmlGenericErrorFunc>, // xmlGenericErrorFunc
974 pub errctx: *mut c_void,
975 pub sortfunc: *mut c_void, // xsltSortFunc
976 pub tmpRVT: *mut _xmlDoc, // xmlDocPtr
977 pub persistRVT: *mut _xmlDoc, // xmlDocPtr
978 pub ctxtflags: c_int,
979 pub lasttext: *const xmlChar,
980 pub lasttsize: c_int,
981 pub lasttuse: c_int,
982 pub debugStatus: c_int,
983 pub traceCode: *mut c_ulong, // unsigned long *
984 pub parserOptions: c_int,
985 pub dict: *mut c_void, // xmlDictPtr
986 pub tmpDoc: *mut _xmlDoc, // xmlDocPtr
987 pub internalized: c_int,
988 pub nbKeys: c_int,
989 pub hasTemplKeyPatterns: c_int,
990 pub currentTemplateRule: *mut _xsltTemplate, // xsltTemplatePtr
991 pub initialContextNode: *mut _xmlNode, // xmlNodePtr
992 pub initialContextDoc: *mut _xmlDoc, // xmlDocPtr
993 pub cache: *mut c_void, // xsltTransformCachePtr
994 pub contextVariable: *mut c_void,
995 pub localRVT: *mut _xmlDoc, // xmlDocPtr
996 pub localRVTBase: *mut _xmlDoc, // xmlDocPtr
997 pub keyInitLevel: c_int,
998 pub depth: c_int,
999 pub maxTemplateDepth: c_int,
1000 pub maxTemplateVars: c_int,
1001 pub opLimit: c_ulong,
1002 pub opCount: c_ulong,
1003 pub sourceDocDirty: c_int,
1004 pub currentId: c_ulong,
1005 pub newLocale: *mut c_void, // xsltNewLocaleFunc
1006 pub freeLocale: *mut c_void, // xsltFreeLocaleFunc
1007 pub genSortKey: *mut c_void, // xsltGenSortKeyFunc
1008}
1009
1010/// XSLT compiled template.
1011///
1012/// # ABI
1013///
1014/// Layout mirrors upstream `struct _xsltTemplate` (xsltInternals.h).
1015#[repr(C)]
1016pub struct _xsltTemplate {
1017 pub next: *mut _xsltTemplate, // next template in list
1018 pub style: *mut _xsltStylesheet, // owning stylesheet
1019 pub r#match: *mut xmlChar, // match pattern (compiled string)
1020 pub priority: f32, // float
1021 pub name: *const xmlChar, // template name (named templates)
1022 pub nameURI: *const xmlChar,
1023 pub mode: *const xmlChar, // template mode
1024 pub modeURI: *const xmlChar,
1025 pub content: *mut _xmlNode, // template content
1026 pub elem: *mut _xmlNode, // the xsl:template node
1027 pub inheritedNsNr: c_int,
1028 pub inheritedNs: *mut *mut _xmlNs, // xmlNsPtr *
1029 pub nbCalls: c_int,
1030 pub time: c_ulong,
1031 pub params: *mut c_void,
1032 pub templNr: c_int,
1033 pub templMax: c_int,
1034 pub templCalledTab: *mut *mut _xsltTemplate, // xsltTemplatePtr *
1035 pub templCountTab: *mut c_int, // int *
1036 pub position: c_int,
1037}
1038
1039/// XSLT document wrapper.
1040///
1041/// # ABI
1042///
1043/// Layout mirrors upstream `struct _xsltDocument` (xsltInternals.h).
1044#[repr(C)]
1045pub struct _xsltDocument {
1046 pub next: *mut _xsltDocument, // next document in list
1047 pub main: c_int, // is this the main stylesheet doc?
1048 pub doc: *mut _xmlDoc, // the wrapped document
1049 pub keys: *mut c_void, // void *
1050 pub includes: *mut _xsltDocument, // list of included documents
1051 pub preproc: c_int, // pre-proc flag
1052 pub nbKeysComputed: c_int,
1053}
1054
1055/// XSLT key definition.
1056///
1057/// # ABI
1058///
1059/// Layout mirrors upstream `struct _xsltKeyDef` (xsltInternals.h).
1060#[repr(C)]
1061pub struct _xsltKeyDef {
1062 pub next: *mut _xsltKeyDef, // next key definition
1063 pub inst: *mut _xmlNode, // the xsl:key instruction node
1064 pub name: *mut xmlChar, // key name
1065 pub nameURI: *mut xmlChar, // key namespace URI
1066 pub r#match: *mut xmlChar, // match pattern
1067 pub r#use: *mut xmlChar, // use expression
1068 pub comp: *mut c_void, // xmlXPathCompExprPtr
1069 pub usecomp: *mut c_void, // xmlXPathCompExprPtr
1070 pub nsList: *mut *mut _xmlNs, // xmlNsPtr *
1071 pub nsNr: c_int,
1072}
1073
1074/// XSLT key table entry.
1075///
1076/// # ABI
1077///
1078/// Layout mirrors upstream `struct _xsltKeyTable` (xsltInternals.h).
1079#[repr(C)]
1080pub struct _xsltKeyTable {
1081 pub next: *mut _xsltKeyTable, // next key table
1082 pub name: *mut xmlChar, // key name
1083 pub nameURI: *mut xmlChar, // key namespace URI
1084 pub keys: *mut c_void, // xmlHashTablePtr
1085}
1086
1087/// XSLT stack element (variable/parameter binding).
1088///
1089/// # ABI
1090///
1091/// Layout mirrors upstream `struct _xsltStackElem` (xsltInternals.h).
1092#[repr(C)]
1093pub struct _xsltStackElem {
1094 pub next: *mut _xsltStackElem, // next stack element
1095 pub comp: *mut c_void, // xsltStylePreCompPtr
1096 pub computed: c_int, // was the value computed?
1097 pub name: *const xmlChar, // variable/parameter name
1098 pub nameURI: *const xmlChar, // namespace URI
1099 pub select: *const xmlChar, // select expression
1100 pub tree: *mut _xmlNode, // content tree (inline content)
1101 pub value: *mut _xmlXPathObject, // evaluated value (xmlXPathObjectPtr)
1102 pub fragment: *mut _xmlDoc, // xmlDocPtr (RVT)
1103 pub level: c_int, // scope level
1104 pub context: *mut _xsltTransformContext, // xsltTransformContextPtr
1105 pub flags: c_int,
1106}
1107
1108/// XSLT decimal format definition.
1109///
1110/// # ABI
1111///
1112/// Layout mirrors upstream `struct _xsltDecimalFormat` (xsltInternals.h).
1113#[repr(C)]
1114pub struct _xsltDecimalFormat {
1115 pub next: *mut _xsltDecimalFormat, // next decimal format
1116 pub name: *mut xmlChar, // format name (NULL = default)
1117 pub digit: *mut xmlChar,
1118 pub patternSeparator: *mut xmlChar,
1119 pub minusSign: *mut xmlChar,
1120 pub infinity: *mut xmlChar,
1121 pub noNumber: *mut xmlChar,
1122 pub decimalPoint: *mut xmlChar,
1123 pub grouping: *mut xmlChar,
1124 pub percent: *mut xmlChar,
1125 pub permille: *mut xmlChar,
1126 pub zeroDigit: *mut xmlChar,
1127 pub nsUri: *const xmlChar,
1128}
1129
1130/// XSLT namespace alias.
1131///
1132/// # UPSTREAM-PARITY
1133///
1134/// Layout matches upstream `_xsltNsAlias` from xsltInternals.h.
1135#[repr(C)]
1136pub struct _xsltNsAlias {
1137 /// Next namespace alias.
1138 pub next: *mut _xsltNsAlias,
1139
1140 /// Result namespace URI.
1141 pub resultNs: *const xmlChar,
1142
1143 /// Stylesheet namespace URI.
1144 pub styleNs: *const xmlChar,
1145}
1146
1147/// XSLT attribute set.
1148///
1149/// # UPSTREAM-PARITY
1150///
1151/// Layout matches upstream `_xsltAttrSet` from xsltInternals.h.
1152#[repr(C)]
1153pub struct _xsltAttrSet {
1154 /// Next attribute set.
1155 pub next: *mut _xsltAttrSet,
1156
1157 /// Attribute set name.
1158 pub name: *const xmlChar,
1159
1160 /// Attribute set namespace URI.
1161 pub ns: *const xmlChar,
1162
1163 /// The xsl:attribute-set instruction node.
1164 pub inst: *mut _xmlNode,
1165
1166 /// Owning stylesheet.
1167 pub style: *mut _xsltStylesheet,
1168
1169 /// Import depth.
1170 pub depth: c_int,
1171}
1172
1173/// XSLT sort element.
1174///
1175/// # UPSTREAM-PARITY
1176///
1177/// Layout matches upstream `_xsltSort` from xsltInternals.h.
1178#[repr(C)]
1179pub struct _xsltSort {
1180 /// Next sort element.
1181 pub next: *mut _xsltSort,
1182
1183 /// The xsl:sort instruction node.
1184 pub inst: *mut _xmlNode,
1185
1186 /// The sort key select expression.
1187 pub select: *const xmlChar,
1188
1189 /// Language for sorting.
1190 pub lang: *const xmlChar,
1191
1192 /// Data type ("text" or "number").
1193 pub dataType: *const xmlChar,
1194
1195 /// Sort order ("ascending" or "descending").
1196 pub order: *const xmlChar,
1197
1198 /// Case order ("upper-first" or "lower-first").
1199 pub caseOrder: *const xmlChar,
1200
1201 /// Whether this sort is a text sort.
1202 pub isText: c_int,
1203
1204 /// Whether the select expression was a constant.
1205 pub hasConst: c_int,
1206
1207 /// Locale information.
1208 pub locale: *mut c_void,
1209
1210 /// Owning stylesheet.
1211 pub style: *mut _xsltStylesheet,
1212
1213 /// Import depth.
1214 pub depth: c_int,
1215}
1216
1217// ── Type aliases for pointer types ──────────────────────────────────────
1218
1219pub type xmlNodePtr = *mut _xmlNode;
1220pub type xmlDocPtr = *mut _xmlDoc;
1221pub type xmlNsPtr = *mut _xmlNs;
1222pub type xmlAttrPtr = *mut _xmlAttr;
1223pub type xmlDtdPtr = *mut _xmlDtd;
1224pub type xmlEntityPtr = *mut _xmlEntity;
1225pub type xmlErrorPtr = *mut _xmlError;
1226pub type xmlParserCtxtPtr = *mut _xmlParserCtxt;
1227pub type xmlParserInputPtr = *mut _xmlParserInput;
1228pub type xmlParserInputBufferPtr = *mut _xmlParserInputBuffer;
1229pub type xmlOutputBufferPtr = *mut _xmlOutputBuffer;
1230pub type xmlSAXHandlerPtr = *mut _xmlSAXHandler;
1231pub type xmlValidCtxtPtr = *mut _xmlValidCtxt;
1232pub type xmlBufferPtr = *mut _xmlBuffer;
1233pub type xmlElementPtr = *mut _xmlElement;
1234pub type xmlElementContentPtr = *mut _xmlElementContent;
1235pub type xmlNotationPtr = *mut _xmlNotation;
1236pub type xmlEnumerationPtr = *mut _xmlEnumeration;
1237pub type xmlAttributeDeclPtr = *mut _xmlAttribute;
1238pub type xmlXPathContextPtr = *mut _xmlXPathContext;
1239pub type xmlXPathObjectPtr = *mut _xmlXPathObject;
1240pub type xmlNodeSetPtr = *mut _xmlNodeSet;
1241pub type xmlCharEncodingHandlerPtr = *mut _xmlCharEncodingHandler;
1242pub type xmlBufPtr = *mut _xmlBuf;
1243pub type xsltStylesheetPtr = *mut _xsltStylesheet;
1244pub type xsltTransformContextPtr = *mut _xsltTransformContext;
1245pub type xsltTemplatePtr = *mut _xsltTemplate;
1246pub type xsltKeyDefPtr = *mut _xsltKeyDef;
1247pub type xsltKeyTablePtr = *mut _xsltKeyTable;
1248pub type xsltStackElemPtr = *mut _xsltStackElem;
1249pub type xsltDecimalFormatPtr = *mut _xsltDecimalFormat;
1250pub type xsltNsAliasPtr = *mut _xsltNsAlias;
1251pub type xsltAttrSetPtr = *mut _xsltAttrSet;
1252pub type xsltDocumentPtr = *mut _xsltDocument;
1253pub type xsltSortPtr = *mut _xsltSort;