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// ── xmlSAXHandler ───────────────────────────────────────────────────────
358//
359// Source: parser.h
360
361/// SAX event handler structure.
362#[repr(C)]
363pub struct _xmlSAXHandler {
364 pub internalSubset: Option<internalSubsetSAXFunc>,
365 pub isStandalone: Option<isStandaloneSAXFunc>,
366 pub hasInternalSubset: Option<hasInternalSubsetSAXFunc>,
367 pub hasExternalSubset: Option<hasExternalSubsetSAXFunc>,
368 pub resolveEntity: Option<resolveEntitySAXFunc>,
369 pub getEntity: Option<getEntitySAXFunc>,
370 pub entityDecl: Option<entityDeclSAXFunc>,
371 pub notationDecl: Option<notationDeclSAXFunc>,
372 pub attributeDecl: Option<attributeDeclSAXFunc>,
373 pub elementDecl: Option<elementDeclSAXFunc>,
374 pub unparsedEntityDecl: Option<unparsedEntityDeclSAXFunc>,
375 pub setDocumentLocator: Option<setDocumentLocatorSAXFunc>,
376 pub startDocument: Option<startDocumentSAXFunc>,
377 pub endDocument: Option<endDocumentSAXFunc>,
378 pub startElement: Option<startElementSAXFunc>,
379 pub endElement: Option<endElementSAXFunc>,
380 pub reference: Option<referenceSAXFunc>,
381 pub characters: Option<charactersSAXFunc>,
382 pub ignorableWhitespace: Option<ignorableWhitespaceSAXFunc>,
383 pub processingInstruction: Option<processingInstructionSAXFunc>,
384 pub comment: Option<commentSAXFunc>,
385 pub warning: Option<warningSAXFunc>,
386 pub error: Option<errorSAXFunc>,
387 pub fatalError: Option<fatalErrorSAXFunc>,
388 pub getParameterEntity: Option<getParameterEntitySAXFunc>,
389 pub cdataBlock: Option<cdataBlockSAXFunc>,
390 pub externalSubset: Option<externalSubsetSAXFunc>,
391 pub initialized: c_uint,
392 pub _private: *mut c_void,
393 pub startElementNs: Option<startElementNsSAX2Func>,
394 pub endElementNs: Option<endElementNsSAX2Func>,
395 pub serror: Option<xmlStructuredErrorFunc>,
396}
397
398// ── xmlParserCtxt ───────────────────────────────────────────────────────
399//
400// Source: parser.h
401
402/// Parser context — the primary parsing state structure.
403#[repr(C)]
404pub struct _xmlParserCtxt {
405 pub sax: *mut _xmlSAXHandler, // SAX handler (deprecated)
406 pub userData: *mut c_void, // User data (deprecated)
407 pub myDoc: *mut _xmlDoc, // Document being built (deprecated)
408 pub wellFormed: c_int, // Is document well formed? (deprecated)
409 pub replaceEntities: c_int, // Replace entities? (deprecated)
410 pub version: *mut xmlChar, // XML version string (deprecated)
411 pub encoding: *mut xmlChar, // Declared encoding (deprecated)
412 pub standalone: c_int, // Standalone document (deprecated)
413 pub html: c_int, // HTML document (deprecated)
414 // Input stream stack
415 pub input: *mut _xmlParserInput, // Current input stream
416 pub inputNr: c_int, // Number of current input streams
417 pub inputMax: c_int, // Max number of input streams (deprecated)
418 pub inputTab: *mut *mut _xmlParserInput, // Stack of inputs
419 // Node analysis stack
420 pub node: *mut _xmlNode, // Current element (deprecated)
421 pub nodeNr: c_int, // Depth of parsing stack (deprecated)
422 pub nodeMax: c_int, // Max depth (deprecated)
423 pub nodeTab: *mut *mut _xmlNode, // Array of nodes (deprecated)
424 // Node info
425 pub record_info: c_int, // Whether node info should be kept
426 pub node_seq: xmlParserNodeInfoSeq, // Info about each node parsed (deprecated)
427 // Error
428 pub errNo: c_int, // Error code (deprecated)
429 // Reference and external subset
430 pub hasExternalSubset: c_int, // (deprecated)
431 pub hasPErefs: c_int, // (deprecated)
432 pub external: c_int, // (deprecated)
433 pub valid: c_int, // Is document valid? (deprecated)
434 pub validate: c_int, // Validate flag (deprecated)
435 pub vctxt: _xmlValidCtxt, // Validity context
436 // Push parser state
437 pub instate: c_int, // (deprecated)
438 pub token: c_int, // (deprecated)
439 pub directory: *mut c_char, // Document directory (deprecated)
440 // Node name stack
441 pub name: *const xmlChar, // Current parsed Node (deprecated)
442 pub nameNr: c_int, // (deprecated)
443 pub nameMax: c_int, // (deprecated)
444 pub nameTab: *mut *const xmlChar, // (deprecated)
445 // Misc
446 pub nbChars: c_long, // (deprecated)
447 pub checkIndex: c_long, // (deprecated)
448 pub keepBlanks: c_int, // (deprecated)
449 pub disableSAX: c_int, // (deprecated)
450 pub inSubset: c_int, // DTD parsing state (deprecated)
451 pub intSubName: *const xmlChar, // Internal subset name (deprecated)
452 pub extSubURI: *mut xmlChar, // External subset URI (deprecated)
453 pub extSubSystem: *mut xmlChar, // External subset public ID (deprecated)
454 // xml:space values
455 pub space: *mut c_int, // (deprecated)
456 pub spaceNr: c_int, // (deprecated)
457 pub spaceMax: c_int, // (deprecated)
458 pub spaceTab: *mut c_int, // (deprecated)
459 // Entity loop prevention
460 pub depth: c_int, // (deprecated)
461 pub entity: *mut _xmlParserInput, // (deprecated)
462 pub charset: c_int, // (deprecated)
463 pub nodelen: c_int, // (deprecated)
464 pub nodemem: c_int, // (deprecated)
465 pub pedantic: c_int, // (deprecated)
466 pub _private: *mut c_void, // User data (deprecated)
467 pub loadsubset: c_int, // Load external subset (deprecated)
468 pub linenumbers: c_int, // (deprecated)
469 pub catalogs: *mut c_void, // (deprecated)
470 pub recovery: c_int, // Recovery mode (deprecated)
471 pub progressive: c_int, // (deprecated)
472 pub dict: *mut c_void, // Dictionary (deprecated)
473 pub atts: *mut *const xmlChar, // Attributes array (deprecated)
474 pub maxatts: c_int, // (deprecated)
475 pub docdict: c_int, // (deprecated)
476 // Pre-interned strings
477 pub str_xml: *const xmlChar, // (deprecated)
478 pub str_xmlns: *const xmlChar, // (deprecated)
479 pub str_xml_ns: *const xmlChar, // (deprecated)
480 // New SAX mode
481 pub sax2: c_int, // (deprecated)
482 pub nsNr: c_int, // (deprecated)
483 pub nsMax: c_int, // (deprecated)
484 pub nsTab: *mut *const xmlChar, // (deprecated)
485 pub attallocs: *mut c_uint, // (deprecated)
486 pub pushTab: *mut c_void, // xmlStartTag (deprecated)
487 pub attsDefault: *mut c_void, // (deprecated)
488 pub attsSpecial: *mut c_void, // (deprecated)
489 pub nsWellFormed: c_int, // (deprecated)
490 pub options: c_int, // Extra options (deprecated)
491 pub dictNames: c_int, // (deprecated)
492 // Streaming
493 pub freeElemsNr: c_int, // (deprecated)
494 pub freeElems: *mut _xmlNode, // (deprecated)
495 pub freeAttrsNr: c_int, // (deprecated)
496 pub freeAttrs: *mut _xmlAttr, // (deprecated)
497 pub lastError: _xmlError, // Last error info (deprecated)
498 pub parseMode: c_int, // (deprecated)
499 pub nbentities: c_ulong, // (deprecated)
500 pub sizeentities: c_ulong, // (deprecated)
501 // HTML non-recursive parser
502 pub nodeInfo: *mut c_void, // (deprecated)
503 pub nodeInfoNr: c_int, // (deprecated)
504 pub nodeInfoMax: c_int, // (deprecated)
505 pub nodeInfoTab: *mut c_void, // (deprecated)
506 pub input_id: c_int, // (deprecated)
507 pub sizeentcopy: c_ulong, // (deprecated)
508 pub endCheckState: c_int, // (deprecated)
509 pub nbErrors: c_ushort, // (deprecated)
510 pub nbWarnings: c_ushort, // (deprecated)
511 pub maxAmpl: c_uint, // (deprecated)
512 // Namespace database
513 pub nsdb: *mut c_void, // (deprecated)
514 pub attrHashMax: c_uint, // (deprecated)
515 pub attrHash: *mut c_void, // (deprecated)
516 // Error handler
517 pub errorHandler: Option<xmlStructuredErrorFunc>, // (deprecated)
518 pub errorCtxt: *mut c_void, // (deprecated)
519 // Resource loader
520 pub resourceLoader: Option<xmlResourceLoader>, // (deprecated)
521 pub resourceCtxt: *mut c_void, // (deprecated)
522 // Encoding conversion
523 pub convImpl: Option<xmlCharEncConvImpl>, // (deprecated)
524 pub convCtxt: *mut c_void, // (deprecated)
525}
526
527// ── xmlValidCtxt ────────────────────────────────────────────────────────
528//
529// Source: valid.h
530
531/// Validation context.
532#[repr(C)]
533pub struct _xmlValidCtxt {
534 pub userData: *mut c_void, // User specific data
535 pub error: Option<xmlValidityErrorFunc>, // Error callback
536 pub warning: Option<xmlValidityWarningFunc>, // Warning callback
537 pub node: *mut _xmlNode, // Current parsed Node
538 pub nodeNr: c_int, // Depth of the parsing stack
539 pub nodeMax: c_int, // Max depth
540 pub nodeTab: *mut *mut _xmlNode, // Array of nodes
541 pub flags: c_uint, // Internal flags
542 pub doc: *mut _xmlDoc, // The document
543 pub valid: c_int, // Temporary validity check result
544 pub vstate: *mut c_void, // Current validation state
545 pub vstateNr: c_int, // Depth of validation stack
546 pub vstateMax: c_int, // Max depth
547 pub vstateTab: *mut c_void, // Array of validation states
548 pub am: *mut c_void, // Automata
549 pub state: *mut c_void, // Automata state
550}
551
552// ── xmlParserNodeInfo ───────────────────────────────────────────────────
553
554/// Node info for parser tracking.
555#[repr(C)]
556pub struct _xmlParserNodeInfo {
557 pub node: *const _xmlNode,
558 pub begin_pos: c_ulong,
559 pub begin_line: c_ulong,
560 pub end_pos: c_ulong,
561 pub end_line: c_ulong,
562}
563
564/// Node info sequence.
565#[repr(C)]
566pub struct _xmlParserNodeInfoSeq {
567 pub block: *mut _xmlParserNodeInfo,
568 pub index: *mut c_int,
569 pub block_max: c_int,
570 pub size: c_int,
571}
572
573/// Typedef alias for `_xmlParserNodeInfoSeq`.
574pub type xmlParserNodeInfoSeq = _xmlParserNodeInfoSeq;
575
576// ── xmlXPathContext ─────────────────────────────────────────────────────
577//
578// Source: xpath.h
579
580/// XPath evaluation context.
581#[repr(C)]
582pub struct _xmlXPathContext {
583 pub doc: *mut _xmlDoc, // The current document
584 pub node: *mut _xmlNode, // The current node
585 pub nb_variables_unused: c_int, // (unused)
586 pub max_variables_unused: c_int, // (unused)
587 pub varHash: *mut c_void, // Hash table of defined variables
588 pub nb_types: c_int, // Number of defined types
589 pub max_types: c_int, // Max number of types
590 pub types: *mut c_void, // Array of defined types (xmlXPathType)
591 pub nb_funcs_unused: c_int, // (unused)
592 pub max_funcs_unused: c_int, // (unused)
593 pub funcHash: *mut c_void, // Hash table of defined funcs
594 pub nb_axis: c_int, // Number of defined axis
595 pub max_axis: c_int, // Max number of axis
596 pub axis: *mut c_void, // Array of defined axis (xmlXPathAxis)
597 pub namespaces: *mut *mut _xmlNs, // Array of namespaces
598 pub nsNr: c_int, // Number of namespaces in scope
599 pub user: *mut c_void, // Function to free
600 pub contextSize: c_int, // Context size
601 pub proximityPosition: c_int, // Proximity position
602 pub xptr: c_int, // XPointer context?
603 pub here: *mut _xmlNode, // For here()
604 pub origin: *mut _xmlNode, // For origin()
605 pub nsHash: *mut c_void, // Namespaces hash table
606 pub varLookupFunc: Option<xmlXPathVariableLookupFunc>, // Variable lookup func
607 pub varLookupData: *mut c_void, // Variable lookup data
608 pub extra: *mut c_void, // Needed for XSLT
609 pub function: *const xmlChar, // Function name when calling a function
610 pub functionURI: *const xmlChar, // Function namespace URI
611 pub funcLookupFunc: Option<xmlXPathFuncLookupFunc>, // Function lookup func
612 pub funcLookupData: *mut c_void, // Function lookup data
613 pub tmpNsList: *mut *mut _xmlNs, // Array of temp namespaces
614 pub tmpNsNr: c_int, // Number of temp namespaces
615 pub userData: *mut c_void, // User specific data
616 pub error: Option<xmlStructuredErrorFunc>, // Error callback
617 pub lastError: _xmlError, // Last error
618 pub debugNode: *mut _xmlNode, // Source node (XSLT)
619 pub dict: *mut c_void, // Dictionary
620 pub flags: c_int, // Compilation flags
621 pub cache: *mut c_void, // Cache for XPath objects
622 pub opLimit: c_ulong, // Resource limits
623 pub opCount: c_ulong,
624 pub depth: c_int,
625}
626
627// ── xmlXPathObject ──────────────────────────────────────────────────────
628//
629// Source: xpath.h
630
631/// XPath evaluated object.
632#[repr(C)]
633pub struct _xmlXPathObject {
634 pub type_: c_int, // Object type
635 pub nodesetval: *mut c_void, // Node set (xmlNodeSet)
636 pub boolval: c_int, // Boolean value
637 pub floatval: f64, // Number value
638 pub stringval: *mut xmlChar, // String value
639 pub user: *mut c_void, // User pointer
640 pub index: c_int, // Index
641 pub user2: *mut c_void, // User pointer 2
642 pub index2: c_int, // Index 2
643}
644
645// ── Node set (contained within XPath objects) ───────────────────────────
646
647/// XPath node set.
648#[repr(C)]
649pub struct _xmlNodeSet {
650 pub nodeNr: c_int, // Number of nodes
651 pub nodeMax: c_int, // Max number of nodes
652 pub nodeTab: *mut *mut _xmlNode, // Array of nodes
653}
654
655// ── XSLT types ──────────────────────────────────────────────────────────
656//
657// Source: xslt.h, xsltInternals.h (from libxslt)
658
659/// XSLT stylesheet (opaque, forward declaration).
660#[repr(C)]
661pub struct _xsltStylesheet {
662 // Filled in when libxslt module is implemented (Phase 8)
663 _unused: [u8; 0],
664}
665
666/// XSLT transform context (opaque, forward declaration).
667#[repr(C)]
668pub struct _xsltTransformContext {
669 // Filled in when libxslt module is implemented (Phase 8)
670 _unused: [u8; 0],
671}
672
673// ── Type aliases for pointer types ──────────────────────────────────────
674
675pub type xmlNodePtr = *mut _xmlNode;
676pub type xmlDocPtr = *mut _xmlDoc;
677pub type xmlNsPtr = *mut _xmlNs;
678pub type xmlAttrPtr = *mut _xmlAttr;
679pub type xmlDtdPtr = *mut _xmlDtd;
680pub type xmlEntityPtr = *mut _xmlEntity;
681pub type xmlErrorPtr = *mut _xmlError;
682pub type xmlParserCtxtPtr = *mut _xmlParserCtxt;
683pub type xmlParserInputPtr = *mut _xmlParserInput;
684pub type xmlParserInputBufferPtr = *mut _xmlParserInputBuffer;
685pub type xmlOutputBufferPtr = *mut _xmlOutputBuffer;
686pub type xmlSAXHandlerPtr = *mut _xmlSAXHandler;
687pub type xmlValidCtxtPtr = *mut _xmlValidCtxt;
688pub type xmlBufferPtr = *mut _xmlBuffer;
689pub type xmlXPathContextPtr = *mut _xmlXPathContext;
690pub type xmlXPathObjectPtr = *mut _xmlXPathObject;
691pub type xmlNodeSetPtr = *mut _xmlNodeSet;
692pub type xsltStylesheetPtr = *mut _xsltStylesheet;
693pub type xsltTransformContextPtr = *mut _xsltTransformContext;