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// ── xmlNs ───────────────────────────────────────────────────────────────
123//
124// Source: tree.h lines 501-512
125
126/// Namespace declaration or XPath namespace node.
127#[repr(C)]
128pub struct _xmlNs {
129 pub next: *mut _xmlNs, // Next namespace
130 pub type_: c_int, // XML_NAMESPACE_DECL
131 pub href: *const xmlChar, // Namespace URI
132 pub prefix: *const xmlChar, // Namespace prefix
133 pub _private: *mut c_void, // Application data
134 pub context: *mut _xmlDoc, // Normally an xmlDoc (deprecated)
135}
136
137// ── xmlDtd ──────────────────────────────────────────────────────────────
138//
139// Source: tree.h lines 538-564
140
141/// DTD (Document Type Definition).
142#[repr(C)]
143pub struct _xmlDtd {
144 pub _private: *mut c_void, // Application data
145 pub type_: c_int, // XML_DTD_NODE
146 pub name: *const xmlChar, // Name of the DTD
147 pub children: *mut _xmlNode, // First child
148 pub last: *mut _xmlNode, // Last child
149 pub parent: *mut _xmlDoc, // Parent node (document)
150 pub next: *mut _xmlNode, // Next sibling
151 pub prev: *mut _xmlNode, // Previous sibling
152 pub doc: *mut _xmlDoc, // Containing document
153 // End of common part
154 pub notations: *mut c_void, // Hash table for notations
155 pub elements: *mut c_void, // Hash table for elements
156 pub attributes: *mut c_void, // Hash table for attributes
157 pub entities: *mut c_void, // Hash table for entities
158 pub ExternalID: *mut xmlChar, // Public identifier
159 pub SystemID: *mut xmlChar, // System identifier
160 pub pentities: *mut c_void, // Hash table for parameter entities
161}
162
163// ── xmlAttr ─────────────────────────────────────────────────────────────
164//
165// Source: tree.h lines 595-615
166
167/// Attribute node.
168#[repr(C)]
169pub struct _xmlAttr {
170 pub _private: *mut c_void, // Application data
171 pub type_: c_int, // XML_ATTRIBUTE_NODE
172 pub name: *const xmlChar, // Local name
173 pub children: *mut _xmlNode, // First child (text value)
174 pub last: *mut _xmlNode, // Last child
175 pub parent: *mut _xmlNode, // Parent node
176 pub next: *mut _xmlAttr, // Next sibling (attribute)
177 pub prev: *mut _xmlAttr, // Previous sibling (attribute)
178 pub doc: *mut _xmlDoc, // Containing document
179 pub ns: *mut _xmlNs, // Namespace if any
180 pub atype: c_int, // Attribute type
181 pub psvi: *mut c_void, // Type/PSVI information
182 pub id: *mut c_void, // ID struct (deprecated)
183}
184
185// ── xmlNode ─────────────────────────────────────────────────────────────
186//
187// Source: tree.h lines 645-688
188
189/// XML node — the core tree structure.
190#[repr(C)]
191pub struct _xmlNode {
192 pub _private: *mut c_void, // Application data
193 pub type_: c_int, // Type enum
194 pub name: *const xmlChar, // Node name
195 pub children: *mut _xmlNode, // First child
196 pub last: *mut _xmlNode, // Last child
197 pub parent: *mut _xmlNode, // Parent node (NULL for documents)
198 pub next: *mut _xmlNode, // Next sibling
199 pub prev: *mut _xmlNode, // Previous sibling
200 pub doc: *mut _xmlDoc, // Associated document
201 // End of common part
202 pub ns: *mut _xmlNs, // Namespace of element
203 pub content: *mut xmlChar, // Content (text/comment/PI)
204 pub properties: *mut _xmlAttr, // First attribute of element
205 pub nsDef: *mut _xmlNs, // First namespace definition
206 pub psvi: *mut c_void, // Type/PSVI information
207 pub line: c_ushort, // Line number
208 pub extra: c_ushort, // Extra data for XPath/XSLT
209}
210
211// ── xmlDoc ──────────────────────────────────────────────────────────────
212//
213// Source: tree.h lines 787-845
214
215/// XML Document.
216#[repr(C)]
217pub struct _xmlDoc {
218 pub _private: *mut c_void, // Application data
219 pub type_: c_int, // XML_DOCUMENT_NODE or XML_HTML_DOCUMENT_NODE
220 pub name: *mut c_char, // NULL
221 pub children: *mut _xmlNode, // First child (root element)
222 pub last: *mut _xmlNode, // Last child
223 pub parent: *mut _xmlNode, // Parent node
224 pub next: *mut _xmlNode, // Next sibling
225 pub prev: *mut _xmlNode, // Previous sibling
226 pub doc: *mut _xmlDoc, // Reference to itself
227 // End of common part
228 pub compression: c_int, // Level of zlib compression
229 pub standalone: c_int, // Standalone document status
230 pub intSubset: *mut _xmlDtd, // Internal subset
231 pub extSubset: *mut _xmlDtd, // External subset
232 pub oldNs: *mut _xmlNs, // Old namespace (used during parsing)
233 pub version: *mut xmlChar, // Version string from XML declaration
234 pub encoding: *mut xmlChar, // Actual encoding
235 pub ids: *mut c_void, // Hash table for ID attributes
236 pub refs: *mut c_void, // Hash table for IDREFs (deprecated)
237 pub URL: *mut xmlChar, // URI of the document
238 pub charset: c_int, // Unused (encoding indicator)
239 pub dict: *mut c_void, // Dictionary for names (opaque _xmlDict)
240 pub psvi: *mut c_void, // Type/PSVI information
241 pub parseFlags: c_int, // Parser options used
242 pub properties: c_int, // Document properties flags
243}
244
245// ── xmlEntity ───────────────────────────────────────────────────────────
246//
247// Source: entities.h lines 42-74
248
249/// Entity declaration.
250#[repr(C)]
251pub struct _xmlEntity {
252 pub _private: *mut c_void, // Application data
253 pub type_: c_int, // XML_ENTITY_DECL (must be second!)
254 pub name: *const xmlChar, // Entity name
255 pub children: *mut _xmlNode, // First child link
256 pub last: *mut _xmlNode, // Last child link
257 pub parent: *mut _xmlDtd, // -> DTD
258 pub next: *mut _xmlNode, // Next sibling link
259 pub prev: *mut _xmlNode, // Previous sibling link
260 pub doc: *mut _xmlDoc, // The containing document
261 pub orig: *mut xmlChar, // Content without ref substitution
262 pub content: *mut xmlChar, // Content or ndata if unparsed
263 pub length: c_int, // The content length
264 pub etype: c_int, // The entity type
265 pub ExternalID: *const xmlChar, // External identifier for PUBLIC
266 pub SystemID: *const xmlChar, // URI for SYSTEM or PUBLIC Entity
267 pub nexte: *mut _xmlEntity, // Unused
268 pub URI: *const xmlChar, // The full URI as computed
269 pub owner: c_int, // Unused
270 pub flags: c_int, // Various flags
271 pub expandedSize: c_ulong, // Expanded size
272}
273
274// ── xmlError ────────────────────────────────────────────────────────────
275//
276// Source: xmlerror.h
277
278/// Structured error information.
279#[repr(C)]
280pub struct _xmlError {
281 pub domain: c_int, // Error domain
282 pub code: c_int, // Error code
283 pub message: *mut c_char, // Human-readable error message
284 pub level: c_int, // Error level
285 pub file: *mut c_char, // Filename if available
286 pub line: c_int, // Line number if available
287 pub str1: *mut c_char, // Extra string information
288 pub str2: *mut c_char, // Extra string information
289 pub str3: *mut c_char, // Extra string information
290 pub int1: c_int, // Extra number information
291 pub int2: c_int, // Column number if available
292 pub ctxt: *mut c_void, // Parser context if available
293 pub node: *mut c_void, // Node if available
294}
295
296// ── xmlParserInput ──────────────────────────────────────────────────────
297//
298// Source: parser.h
299
300/// Parser input stream.
301#[repr(C)]
302pub struct _xmlParserInput {
303 pub buf: *mut _xmlParserInputBuffer, // Input buffer (deprecated)
304 pub filename: *const c_char, // The filename or URI (deprecated)
305 pub directory: *const c_char, // Unused (deprecated)
306 pub base: *const xmlChar, // Base of the array to parse
307 pub cur: *const xmlChar, // Current char being parsed (deprecated)
308 pub end: *const xmlChar, // End of the array to parse
309 pub length: c_int, // Unused (deprecated)
310 pub line: c_int, // Current line (deprecated)
311 pub col: c_int, // Current column (deprecated)
312 pub consumed: c_ulong, // How many xmlChars consumed (deprecated)
313 pub free: Option<unsafe extern "C" fn(*mut c_char)>, // Deallocation func (deprecated)
314 pub encoding: *const xmlChar, // Unused (deprecated)
315 pub version: *const xmlChar, // The version string for entity (deprecated)
316 pub flags: c_int, // Flags (deprecated)
317 pub id: c_int, // Unique identifier (deprecated)
318 pub parentConsumed: c_ulong, // Unused (deprecated)
319 pub entity: *mut _xmlEntity, // Entity if any (deprecated)
320}
321
322// ── xmlParserInputBuffer ────────────────────────────────────────────────
323//
324// Source: xmlIO.h
325
326/// Parser input buffer.
327#[repr(C)]
328pub struct _xmlParserInputBuffer {
329 pub context: *mut c_void, // (deprecated)
330 pub readcallback: Option<xmlInputReadCallback>, // (deprecated)
331 pub closecallback: Option<xmlInputCloseCallback>, // (deprecated)
332 pub encoder: *mut c_void, // I18N converter (deprecated)
333 pub buffer: *mut c_void, // Local buffer (deprecated)
334 pub raw: *mut c_void, // Raw input buffer (deprecated)
335 pub compressed: c_int, // Compression flag (deprecated)
336 pub error: c_int, // (deprecated)
337 pub rawconsumed: c_ulong, // (deprecated)
338}
339
340// ── xmlOutputBuffer ─────────────────────────────────────────────────────
341//
342// Source: xmlIO.h
343
344/// Output buffer.
345#[repr(C)]
346pub struct _xmlOutputBuffer {
347 pub context: *mut c_void, // (deprecated)
348 pub writecallback: Option<xmlOutputWriteCallback>, // (deprecated)
349 pub closecallback: Option<xmlOutputCloseCallback>, // (deprecated)
350 pub encoder: *mut c_void, // I18N converter
351 pub buffer: *mut c_void, // Local buffer
352 pub conv: *mut c_void, // Output conversion buffer
353 pub written: c_int, // Total bytes written
354 pub error: c_int, // Error flag
355}
356
357// ── xmlCharEncodingHandler ───────────────────────────────────────────────
358//
359// Source: encoding.h
360
361/// Character encoding conversion handler.
362#[repr(C)]
363pub struct _xmlCharEncodingHandler {
364 pub name: *mut c_char, // Encoding name
365 pub input: c_int, // Input xmlCharEncoding
366 pub output: c_int, // Output xmlCharEncoding
367 pub input_func: Option<xmlCharEncodingInputFunc>, // Input conversion func
368 pub output_func: Option<xmlCharEncodingOutputFunc>, // Output conversion func
369 pub iconv_in: *mut c_void, // Iconv descriptor for input
370 pub iconv_out: *mut c_void, // Iconv descriptor for output
371}
372
373// ── xmlBuf ──────────────────────────────────────────────────────────────
374//
375// Source: tree.h
376
377/// Buffer structure (modern replacement for xmlBuffer).
378#[repr(C)]
379pub struct _xmlBuf {
380 pub content: *mut xmlChar, // The buffer content UTF8
381 pub use_: c_uint, // The buffer size used
382 pub size: c_uint, // The buffer size
383 pub alloc: c_int, // The realloc method
384 pub error: c_int, // Error flag
385 pub buffer: c_int, // Is this a buffer from xmlBuffer?
386 pub io: c_int, // In IO mode?
387}
388
389// ── xmlSAXHandler ───────────────────────────────────────────────────────
390//
391// Source: parser.h
392
393/// SAX event handler structure.
394#[repr(C)]
395pub struct _xmlSAXHandler {
396 pub internalSubset: Option<internalSubsetSAXFunc>,
397 pub isStandalone: Option<isStandaloneSAXFunc>,
398 pub hasInternalSubset: Option<hasInternalSubsetSAXFunc>,
399 pub hasExternalSubset: Option<hasExternalSubsetSAXFunc>,
400 pub resolveEntity: Option<resolveEntitySAXFunc>,
401 pub getEntity: Option<getEntitySAXFunc>,
402 pub entityDecl: Option<entityDeclSAXFunc>,
403 pub notationDecl: Option<notationDeclSAXFunc>,
404 pub attributeDecl: Option<attributeDeclSAXFunc>,
405 pub elementDecl: Option<elementDeclSAXFunc>,
406 pub unparsedEntityDecl: Option<unparsedEntityDeclSAXFunc>,
407 pub setDocumentLocator: Option<setDocumentLocatorSAXFunc>,
408 pub startDocument: Option<startDocumentSAXFunc>,
409 pub endDocument: Option<endDocumentSAXFunc>,
410 pub startElement: Option<startElementSAXFunc>,
411 pub endElement: Option<endElementSAXFunc>,
412 pub reference: Option<referenceSAXFunc>,
413 pub characters: Option<charactersSAXFunc>,
414 pub ignorableWhitespace: Option<ignorableWhitespaceSAXFunc>,
415 pub processingInstruction: Option<processingInstructionSAXFunc>,
416 pub comment: Option<commentSAXFunc>,
417 pub warning: Option<warningSAXFunc>,
418 pub error: Option<errorSAXFunc>,
419 pub fatalError: Option<fatalErrorSAXFunc>,
420 pub getParameterEntity: Option<getParameterEntitySAXFunc>,
421 pub cdataBlock: Option<cdataBlockSAXFunc>,
422 pub externalSubset: Option<externalSubsetSAXFunc>,
423 pub initialized: c_uint,
424 pub _private: *mut c_void,
425 pub startElementNs: Option<startElementNsSAX2Func>,
426 pub endElementNs: Option<endElementNsSAX2Func>,
427 pub serror: Option<xmlStructuredErrorFunc>,
428}
429
430// ── xmlParserCtxt ───────────────────────────────────────────────────────
431//
432// Source: parser.h
433
434/// Parser context — the primary parsing state structure.
435#[repr(C)]
436pub struct _xmlParserCtxt {
437 pub sax: *mut _xmlSAXHandler, // SAX handler (deprecated)
438 pub userData: *mut c_void, // User data (deprecated)
439 pub myDoc: *mut _xmlDoc, // Document being built (deprecated)
440 pub wellFormed: c_int, // Is document well formed? (deprecated)
441 pub replaceEntities: c_int, // Replace entities? (deprecated)
442 pub version: *mut xmlChar, // XML version string (deprecated)
443 pub encoding: *mut xmlChar, // Declared encoding (deprecated)
444 pub standalone: c_int, // Standalone document (deprecated)
445 pub html: c_int, // HTML document (deprecated)
446 // Input stream stack
447 pub input: *mut _xmlParserInput, // Current input stream
448 pub inputNr: c_int, // Number of current input streams
449 pub inputMax: c_int, // Max number of input streams (deprecated)
450 pub inputTab: *mut *mut _xmlParserInput, // Stack of inputs
451 // Node analysis stack
452 pub node: *mut _xmlNode, // Current element (deprecated)
453 pub nodeNr: c_int, // Depth of parsing stack (deprecated)
454 pub nodeMax: c_int, // Max depth (deprecated)
455 pub nodeTab: *mut *mut _xmlNode, // Array of nodes (deprecated)
456 // Node info
457 pub record_info: c_int, // Whether node info should be kept
458 pub node_seq: xmlParserNodeInfoSeq, // Info about each node parsed (deprecated)
459 // Error
460 pub errNo: c_int, // Error code (deprecated)
461 // Reference and external subset
462 pub hasExternalSubset: c_int, // (deprecated)
463 pub hasPErefs: c_int, // (deprecated)
464 pub external: c_int, // (deprecated)
465 pub valid: c_int, // Is document valid? (deprecated)
466 pub validate: c_int, // Validate flag (deprecated)
467 pub vctxt: _xmlValidCtxt, // Validity context
468 // Push parser state
469 pub instate: c_int, // (deprecated)
470 pub token: c_int, // (deprecated)
471 pub directory: *mut c_char, // Document directory (deprecated)
472 // Node name stack
473 pub name: *const xmlChar, // Current parsed Node (deprecated)
474 pub nameNr: c_int, // (deprecated)
475 pub nameMax: c_int, // (deprecated)
476 pub nameTab: *mut *const xmlChar, // (deprecated)
477 // Misc
478 pub nbChars: c_long, // (deprecated)
479 pub checkIndex: c_long, // (deprecated)
480 pub keepBlanks: c_int, // (deprecated)
481 pub disableSAX: c_int, // (deprecated)
482 pub inSubset: c_int, // DTD parsing state (deprecated)
483 pub intSubName: *const xmlChar, // Internal subset name (deprecated)
484 pub extSubURI: *mut xmlChar, // External subset URI (deprecated)
485 pub extSubSystem: *mut xmlChar, // External subset public ID (deprecated)
486 // xml:space values
487 pub space: *mut c_int, // (deprecated)
488 pub spaceNr: c_int, // (deprecated)
489 pub spaceMax: c_int, // (deprecated)
490 pub spaceTab: *mut c_int, // (deprecated)
491 // Entity loop prevention
492 pub depth: c_int, // (deprecated)
493 pub entity: *mut _xmlParserInput, // (deprecated)
494 pub charset: c_int, // (deprecated)
495 pub nodelen: c_int, // (deprecated)
496 pub nodemem: c_int, // (deprecated)
497 pub pedantic: c_int, // (deprecated)
498 pub _private: *mut c_void, // User data (deprecated)
499 pub loadsubset: c_int, // Load external subset (deprecated)
500 pub linenumbers: c_int, // (deprecated)
501 pub catalogs: *mut c_void, // (deprecated)
502 pub recovery: c_int, // Recovery mode (deprecated)
503 pub progressive: c_int, // (deprecated)
504 pub dict: *mut c_void, // Dictionary (deprecated)
505 pub atts: *mut *const xmlChar, // Attributes array (deprecated)
506 pub maxatts: c_int, // (deprecated)
507 pub docdict: c_int, // (deprecated)
508 // Pre-interned strings
509 pub str_xml: *const xmlChar, // (deprecated)
510 pub str_xmlns: *const xmlChar, // (deprecated)
511 pub str_xml_ns: *const xmlChar, // (deprecated)
512 // New SAX mode
513 pub sax2: c_int, // (deprecated)
514 pub nsNr: c_int, // (deprecated)
515 pub nsMax: c_int, // (deprecated)
516 pub nsTab: *mut *const xmlChar, // (deprecated)
517 pub attallocs: *mut c_uint, // (deprecated)
518 pub pushTab: *mut c_void, // xmlStartTag (deprecated)
519 pub attsDefault: *mut c_void, // (deprecated)
520 pub attsSpecial: *mut c_void, // (deprecated)
521 pub nsWellFormed: c_int, // (deprecated)
522 pub options: c_int, // Extra options (deprecated)
523 pub dictNames: c_int, // (deprecated)
524 // Streaming
525 pub freeElemsNr: c_int, // (deprecated)
526 pub freeElems: *mut _xmlNode, // (deprecated)
527 pub freeAttrsNr: c_int, // (deprecated)
528 pub freeAttrs: *mut _xmlAttr, // (deprecated)
529 pub lastError: _xmlError, // Last error info (deprecated)
530 pub parseMode: c_int, // (deprecated)
531 pub nbentities: c_ulong, // (deprecated)
532 pub sizeentities: c_ulong, // (deprecated)
533 // HTML non-recursive parser
534 pub nodeInfo: *mut c_void, // (deprecated)
535 pub nodeInfoNr: c_int, // (deprecated)
536 pub nodeInfoMax: c_int, // (deprecated)
537 pub nodeInfoTab: *mut c_void, // (deprecated)
538 pub input_id: c_int, // (deprecated)
539 pub sizeentcopy: c_ulong, // (deprecated)
540 pub endCheckState: c_int, // (deprecated)
541 pub nbErrors: c_ushort, // (deprecated)
542 pub nbWarnings: c_ushort, // (deprecated)
543 pub maxAmpl: c_uint, // (deprecated)
544 // Namespace database
545 pub nsdb: *mut c_void, // (deprecated)
546 pub attrHashMax: c_uint, // (deprecated)
547 pub attrHash: *mut c_void, // (deprecated)
548 // Error handler
549 pub errorHandler: Option<xmlStructuredErrorFunc>, // (deprecated)
550 pub errorCtxt: *mut c_void, // (deprecated)
551 // Resource loader
552 pub resourceLoader: Option<xmlResourceLoader>, // (deprecated)
553 pub resourceCtxt: *mut c_void, // (deprecated)
554 // Encoding conversion
555 pub convImpl: Option<xmlCharEncConvImpl>, // (deprecated)
556 pub convCtxt: *mut c_void, // (deprecated)
557}
558
559// ── xmlValidCtxt ────────────────────────────────────────────────────────
560//
561// Source: valid.h
562
563/// Validation context.
564#[repr(C)]
565pub struct _xmlValidCtxt {
566 pub userData: *mut c_void, // User specific data
567 pub error: Option<xmlValidityErrorFunc>, // Error callback
568 pub warning: Option<xmlValidityWarningFunc>, // Warning callback
569 pub node: *mut _xmlNode, // Current parsed Node
570 pub nodeNr: c_int, // Depth of the parsing stack
571 pub nodeMax: c_int, // Max depth
572 pub nodeTab: *mut *mut _xmlNode, // Array of nodes
573 pub flags: c_uint, // Internal flags
574 pub doc: *mut _xmlDoc, // The document
575 pub valid: c_int, // Temporary validity check result
576 pub vstate: *mut c_void, // Current validation state
577 pub vstateNr: c_int, // Depth of validation stack
578 pub vstateMax: c_int, // Max depth
579 pub vstateTab: *mut c_void, // Array of validation states
580 pub am: *mut c_void, // Automata
581 pub state: *mut c_void, // Automata state
582}
583
584// ── xmlParserNodeInfo ───────────────────────────────────────────────────
585
586/// Node info for parser tracking.
587#[repr(C)]
588pub struct _xmlParserNodeInfo {
589 pub node: *const _xmlNode,
590 pub begin_pos: c_ulong,
591 pub begin_line: c_ulong,
592 pub end_pos: c_ulong,
593 pub end_line: c_ulong,
594}
595
596/// Node info sequence.
597#[repr(C)]
598pub struct _xmlParserNodeInfoSeq {
599 pub block: *mut _xmlParserNodeInfo,
600 pub index: *mut c_int,
601 pub block_max: c_int,
602 pub size: c_int,
603}
604
605/// Typedef alias for `_xmlParserNodeInfoSeq`.
606pub type xmlParserNodeInfoSeq = _xmlParserNodeInfoSeq;
607
608// ── xmlXPathContext ─────────────────────────────────────────────────────
609//
610// Source: xpath.h
611
612/// XPath evaluation context.
613#[repr(C)]
614pub struct _xmlXPathContext {
615 pub doc: *mut _xmlDoc, // The current document
616 pub node: *mut _xmlNode, // The current node
617 pub nb_variables_unused: c_int, // (unused)
618 pub max_variables_unused: c_int, // (unused)
619 pub varHash: *mut c_void, // Hash table of defined variables
620 pub nb_types: c_int, // Number of defined types
621 pub max_types: c_int, // Max number of types
622 pub types: *mut c_void, // Array of defined types (xmlXPathType)
623 pub nb_funcs_unused: c_int, // (unused)
624 pub max_funcs_unused: c_int, // (unused)
625 pub funcHash: *mut c_void, // Hash table of defined funcs
626 pub nb_axis: c_int, // Number of defined axis
627 pub max_axis: c_int, // Max number of axis
628 pub axis: *mut c_void, // Array of defined axis (xmlXPathAxis)
629 pub namespaces: *mut *mut _xmlNs, // Array of namespaces
630 pub nsNr: c_int, // Number of namespaces in scope
631 pub user: *mut c_void, // Function to free
632 pub contextSize: c_int, // Context size
633 pub proximityPosition: c_int, // Proximity position
634 pub xptr: c_int, // XPointer context?
635 pub here: *mut _xmlNode, // For here()
636 pub origin: *mut _xmlNode, // For origin()
637 pub nsHash: *mut c_void, // Namespaces hash table
638 pub varLookupFunc: Option<xmlXPathVariableLookupFunc>, // Variable lookup func
639 pub varLookupData: *mut c_void, // Variable lookup data
640 pub extra: *mut c_void, // Needed for XSLT
641 pub function: *const xmlChar, // Function name when calling a function
642 pub functionURI: *const xmlChar, // Function namespace URI
643 pub funcLookupFunc: Option<xmlXPathFuncLookupFunc>, // Function lookup func
644 pub funcLookupData: *mut c_void, // Function lookup data
645 pub tmpNsList: *mut *mut _xmlNs, // Array of temp namespaces
646 pub tmpNsNr: c_int, // Number of temp namespaces
647 pub userData: *mut c_void, // User specific data
648 pub error: Option<xmlStructuredErrorFunc>, // Error callback
649 pub lastError: _xmlError, // Last error
650 pub debugNode: *mut _xmlNode, // Source node (XSLT)
651 pub dict: *mut c_void, // Dictionary
652 pub flags: c_int, // Compilation flags
653 pub cache: *mut c_void, // Cache for XPath objects
654 pub opLimit: c_ulong, // Resource limits
655 pub opCount: c_ulong,
656 pub depth: c_int,
657}
658
659// ── xmlXPathObject ──────────────────────────────────────────────────────
660//
661// Source: xpath.h
662
663/// XPath evaluated object.
664#[repr(C)]
665pub struct _xmlXPathObject {
666 pub type_: c_int, // Object type
667 pub nodesetval: *mut c_void, // Node set (xmlNodeSet)
668 pub boolval: c_int, // Boolean value
669 pub floatval: f64, // Number value
670 pub stringval: *mut xmlChar, // String value
671 pub user: *mut c_void, // User pointer
672 pub index: c_int, // Index
673 pub user2: *mut c_void, // User pointer 2
674 pub index2: c_int, // Index 2
675}
676
677// ── Node set (contained within XPath objects) ───────────────────────────
678
679/// XPath node set.
680#[repr(C)]
681pub struct _xmlNodeSet {
682 pub nodeNr: c_int, // Number of nodes
683 pub nodeMax: c_int, // Max number of nodes
684 pub nodeTab: *mut *mut _xmlNode, // Array of nodes
685}
686
687// ── XSLT types ──────────────────────────────────────────────────────────
688//
689// Source: xslt.h, xsltInternals.h (from libxslt)
690
691/// XSLT stylesheet (opaque, forward declaration).
692#[repr(C)]
693pub struct _xsltStylesheet {
694 // Filled in when libxslt module is implemented (Phase 8)
695 _unused: [u8; 0],
696}
697
698/// XSLT transform context (opaque, forward declaration).
699#[repr(C)]
700pub struct _xsltTransformContext {
701 // Filled in when libxslt module is implemented (Phase 8)
702 _unused: [u8; 0],
703}
704
705// ── Type aliases for pointer types ──────────────────────────────────────
706
707pub type xmlNodePtr = *mut _xmlNode;
708pub type xmlDocPtr = *mut _xmlDoc;
709pub type xmlNsPtr = *mut _xmlNs;
710pub type xmlAttrPtr = *mut _xmlAttr;
711pub type xmlDtdPtr = *mut _xmlDtd;
712pub type xmlEntityPtr = *mut _xmlEntity;
713pub type xmlErrorPtr = *mut _xmlError;
714pub type xmlParserCtxtPtr = *mut _xmlParserCtxt;
715pub type xmlParserInputPtr = *mut _xmlParserInput;
716pub type xmlParserInputBufferPtr = *mut _xmlParserInputBuffer;
717pub type xmlOutputBufferPtr = *mut _xmlOutputBuffer;
718pub type xmlSAXHandlerPtr = *mut _xmlSAXHandler;
719pub type xmlValidCtxtPtr = *mut _xmlValidCtxt;
720pub type xmlBufferPtr = *mut _xmlBuffer;
721pub type xmlXPathContextPtr = *mut _xmlXPathContext;
722pub type xmlXPathObjectPtr = *mut _xmlXPathObject;
723pub type xmlNodeSetPtr = *mut _xmlNodeSet;
724pub type xmlCharEncodingHandlerPtr = *mut _xmlCharEncodingHandler;
725pub type xmlBufPtr = *mut _xmlBuf;
726pub type xsltStylesheetPtr = *mut _xsltStylesheet;
727pub type xsltTransformContextPtr = *mut _xsltTransformContext;