libxml_rs/abi/exports_xml2.rs
1//! C ABI exports for libxml2.so.2 — no_mangle extern "C" functions (§1, §16).
2//!
3//! This module contains all `#[no_mangle] pub extern "C"` function definitions
4//! that form the public ABI of libxml2.so.2. Every function here corresponds to
5//! a function in the upstream libxml2 headers.
6//!
7//! # Phase 1 status
8//!
9//! Complete — all major ABI entry points are implemented. Functions that require
10//! modules not yet implemented (tree, parser, etc.) call into those modules,
11//! which will be filled in as Phase 1 continues.
12//!
13//! # Organization
14//!
15//! Exports are grouped by subsystem in the order they appear in upstream headers:
16//!
17//! 1. Initialization / Cleanup
18//! 2. Version
19//! 3. Memory / Allocator
20//! 4. Error handling
21//! 5. String utilities
22//! 6. Tree (document, node, attribute, namespace, DTD, entity)
23//! 7. Parser (SAX, DOM, push, reader)
24//! 8. I/O
25//! 9. Dictionary
26//! 10. Hash table
27//! 11. List
28//! 12. Buffer
29//! 13. Encoding
30//! 14. XPath
31//! 15. XInclude
32//! 16. Catalog
33//! 17. HTML
34//! 18. Debug/misc
35
36#![allow(non_snake_case)]
37#![allow(unused_variables)]
38#![allow(clippy::missing_safety_doc)]
39#![allow(clippy::not_unsafe_ptr_arg_deref)]
40
41use core::ffi::c_void;
42use core::ptr;
43use std::mem::size_of;
44use std::os::raw::{c_char, c_int, c_uint};
45
46use crate::abi::allocator::*;
47use crate::abi::callbacks::*;
48use crate::abi::ownership::*;
49use crate::abi::structs::*;
50use crate::abi::types::xmlAttributeType::XML_ATTRIBUTE_CDATA;
51use crate::abi::types::xmlElementType::*;
52use crate::abi::types::xmlErrorLevel::XML_ERR_NONE;
53use crate::abi::types::*;
54use crate::abi::versioning::*;
55
56// ═══════════════════════════════════════════════════════════════════════════════
57// 1. Initialization / Cleanup
58// ═══════════════════════════════════════════════════════════════════════════════
59
60/// Initialize the parser library.
61///
62/// Must be called before any other libxml2 functions.
63/// Safe to call multiple times (reference-counted in modern libxml2).
64///
65/// # UPSTREAM-PARITY
66///
67/// ```c
68/// void xmlInitParser(void);
69/// ```
70#[no_mangle]
71pub unsafe extern "C" fn xmlInitParser() {
72 crate::internal::globals::init_parser();
73}
74
75/// Clean up the parser library.
76///
77/// Should be called when the library is no longer needed.
78///
79/// # UPSTREAM-PARITY
80///
81/// ```c
82/// void xmlCleanupParser(void);
83/// ```
84#[no_mangle]
85pub unsafe extern "C" fn xmlCleanupParser() {
86 crate::internal::globals::cleanup_parser();
87}
88
89/// Initialize threading support.
90///
91/// # UPSTREAM-PARITY
92///
93/// ```c
94/// int xmlInitThreads(void);
95/// ```
96///
97/// Returns 0 on success.
98#[no_mangle]
99pub unsafe extern "C" fn xmlInitThreads() -> c_int {
100 crate::internal::globals::init_threads()
101}
102
103/// Clean up threading support.
104///
105/// # UPSTREAM-PARITY
106///
107/// ```c
108/// void xmlCleanupThreads(void);
109/// ```
110#[no_mangle]
111pub unsafe extern "C" fn xmlCleanupThreads() {
112 crate::xml::threads::cleanup_threads();
113}
114
115/// Check whether the library has been initialized.
116///
117/// # UPSTREAM-PARITY
118///
119/// ```c
120/// int xmlIsInitialized(void);
121/// ```
122#[no_mangle]
123pub extern "C" fn xmlIsInitialized() -> c_int {
124 if crate::abi::versioning::is_initialized() {
125 1
126 } else {
127 0
128 }
129}
130
131/// Initialize a set of threads (libxml2 compat).
132///
133/// # UPSTREAM-PARITY
134///
135/// ```c
136/// int xmlInitThreads(void);
137/// ```
138/// This is an alias.
139#[no_mangle]
140pub unsafe extern "C" fn xmlLockLibrary() {
141 crate::xml::threads::lock_library();
142}
143
144/// Unlock the library (libxml2 compat).
145///
146/// # UPSTREAM-PARITY
147///
148/// ```c
149/// void xmlUnlockLibrary(void);
150/// ```
151#[no_mangle]
152pub unsafe extern "C" fn xmlUnlockLibrary() {
153 crate::xml::threads::unlock_library();
154}
155
156// ═══════════════════════════════════════════════════════════════════════════════
157// 4. Error Handling
158// ═══════════════════════════════════════════════════════════════════════════════
159
160/// Set the generic error handler.
161///
162/// # UPSTREAM-PARITY
163///
164/// ```c
165/// void xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler);
166/// ```
167///
168/// # SAFETY
169///
170/// - `handler` must be a valid function pointer or NULL (to reset to default).
171/// - If non-NULL, the handler may be called at any time with `ctx`.
172#[no_mangle]
173pub unsafe extern "C" fn xmlSetGenericErrorFunc(
174 ctx: *mut c_void,
175 handler: Option<xmlGenericErrorFunc>,
176) {
177 // SAFETY: Delegates to xml::errors with same safety contract.
178 unsafe { crate::xml::errors::set_generic_error_func(ctx, handler) };
179}
180
181/// Set the structured error handler.
182///
183/// # UPSTREAM-PARITY
184///
185/// ```c
186/// void xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler);
187/// ```
188///
189/// # SAFETY
190///
191/// - `handler` must be a valid function pointer or NULL.
192#[no_mangle]
193pub unsafe extern "C" fn xmlSetStructuredErrorFunc(
194 ctx: *mut c_void,
195 handler: Option<xmlStructuredErrorFunc>,
196) {
197 // SAFETY: Delegates to xml::errors with same safety contract.
198 unsafe { crate::xml::errors::set_structured_error_func(ctx, handler) };
199}
200
201/// Get the last error for the current thread.
202///
203/// # UPSTREAM-PARITY
204///
205/// ```c
206/// xmlErrorPtr xmlGetLastError(void);
207/// ```
208///
209/// Returns a pointer to the last error, or NULL if no error occurred.
210/// The returned pointer is valid until the next libxml2 call in this thread.
211#[no_mangle]
212pub extern "C" fn xmlGetLastError() -> *mut _xmlError {
213 crate::xml::errors::get_last_error()
214}
215
216/// Get a copy of the last error for the current thread.
217///
218/// # UPSTREAM-PARITY
219///
220/// ```c
221/// xmlErrorPtr xmlCopyError(xmlErrorPtr from, xmlErrorPtr to);
222/// ```
223///
224/// Copies `from` into `to`. Returns 0 on success, -1 on error.
225///
226/// # SAFETY
227///
228/// - `from` and `to` must be valid pointers to `_xmlError` structs, or NULL.
229#[no_mangle]
230pub unsafe extern "C" fn xmlCopyError(from: *const _xmlError, to: *mut _xmlError) -> c_int {
231 // SAFETY: Delegates to xml::errors with same safety contract.
232 unsafe { crate::xml::errors::copy_error(from, to) }
233}
234
235/// Reset an error structure.
236///
237/// # UPSTREAM-PARITY
238///
239/// ```c
240/// void xmlResetError(xmlErrorPtr err);
241/// ```
242///
243/// # SAFETY
244///
245/// - `err` must be a valid pointer to `_xmlError`, or NULL.
246#[no_mangle]
247pub unsafe extern "C" fn xmlResetError(err: *mut _xmlError) {
248 // SAFETY: Delegates to xml::errors with same safety contract.
249 unsafe { crate::xml::errors::reset_error(err) };
250}
251
252/// Raise a structured error.
253///
254/// This is called internally when an error occurs. It updates the last error
255/// and invokes the structured error handler if one is set.
256///
257/// # SAFETY
258///
259/// - `ctxt` may be NULL (context of the error).
260/// - `domain`, `code`, `level`: valid error codes.
261/// - `msg` must be a valid C string or NULL.
262/// - `file` must be a valid C string or NULL.
263/// - `str1`, `str2`, `str3`: error-related strings (may be NULL).
264#[no_mangle]
265pub unsafe extern "C" fn xmlRaiseError(
266 ctxt: *mut c_void,
267 ctxt2: *mut c_void,
268 ctxt3: *mut c_void,
269 ctxt4: *mut c_void,
270 ctxt5: *mut c_void,
271 domain: c_int,
272 code: c_int,
273 level: c_int,
274 file: *const c_char,
275 line: c_int,
276 str1: *const c_char,
277 str2: *const c_char,
278 str3: *const c_char,
279 int1: c_int,
280 int2: c_int,
281 msg: *const c_char,
282) {
283 // SAFETY: Delegates to xml::errors with same safety contract.
284 unsafe {
285 crate::xml::errors::raise_error(
286 ctxt, ctxt2, ctxt3, ctxt4, ctxt5, domain, code, level, file, line, str1, str2, str3,
287 int1, int2, msg,
288 );
289 }
290}
291
292/// Remove any error from the last error stack.
293///
294/// # UPSTREAM-PARITY
295///
296/// ```c
297/// void xmlResetLastError(void);
298/// ```
299#[no_mangle]
300pub extern "C" fn xmlResetLastError() {
301 crate::xml::errors::reset_last_error();
302}
303
304// ═══════════════════════════════════════════════════════════════════════════════
305// 5. String Utilities
306// ═══════════════════════════════════════════════════════════════════════════════
307
308/// Duplicate a string using xmlChar.
309///
310/// # UPSTREAM-PARITY
311///
312/// ```c
313/// xmlChar *xmlStrdup(const xmlChar *cur);
314/// ```
315///
316/// # SAFETY
317///
318/// - `cur` must be a valid null-terminated xmlChar string or NULL.
319#[no_mangle]
320pub unsafe extern "C" fn xmlStrdup(cur: *const xmlChar) -> *mut xmlChar {
321 if cur.is_null() {
322 return ptr::null_mut();
323 }
324 let len = unsafe { xmlStrlen(cur) };
325 let size = len + 1;
326 let new_ptr = unsafe { xmlMalloc(size as usize) };
327 if new_ptr.is_null() {
328 return ptr::null_mut();
329 }
330 unsafe {
331 ptr::copy_nonoverlapping(cur as *const u8, new_ptr as *mut u8, size as usize);
332 }
333 new_ptr as *mut xmlChar
334}
335
336/// Duplicate a substring.
337///
338/// # UPSTREAM-PARITY
339///
340/// ```c
341/// xmlChar *xmlStrndup(const xmlChar *cur, int len);
342/// ```
343///
344/// # SAFETY
345///
346/// - `cur` must be a valid pointer or NULL.
347#[no_mangle]
348pub unsafe extern "C" fn xmlStrndup(cur: *const xmlChar, len: c_int) -> *mut xmlChar {
349 if cur.is_null() || len <= 0 {
350 return ptr::null_mut();
351 }
352 let size = len as usize + 1;
353 let new_ptr = unsafe { xmlMalloc(size) };
354 if new_ptr.is_null() {
355 return ptr::null_mut();
356 }
357 unsafe {
358 ptr::copy_nonoverlapping(cur as *const u8, new_ptr as *mut u8, len as usize);
359 *(new_ptr.add(len as usize) as *mut u8) = 0;
360 }
361 new_ptr as *mut xmlChar
362}
363
364/// Get the length of an xmlChar string.
365///
366/// # UPSTREAM-PARITY
367///
368/// ```c
369/// int xmlStrlen(const xmlChar *str);
370/// ```
371///
372/// # SAFETY
373///
374/// - `str` must be a valid null-terminated string or NULL (returns 0).
375#[no_mangle]
376pub unsafe extern "C" fn xmlStrlen(str: *const xmlChar) -> c_int {
377 if str.is_null() {
378 return 0;
379 }
380 unsafe { libc::strlen(str as *const c_char) as c_int }
381}
382
383/// Compare two xmlChar strings.
384///
385/// # UPSTREAM-PARITY
386///
387/// ```c
388/// int xmlStrcmp(const xmlChar *str1, const xmlChar *str2);
389/// ```
390///
391/// Returns 0 if equal, <0 if str1 < str2, >0 if str1 > str2.
392/// NULL-safe: NULL sorts before any non-NULL string.
393#[no_mangle]
394pub unsafe extern "C" fn xmlStrcmp(str1: *const xmlChar, str2: *const xmlChar) -> c_int {
395 if str1.is_null() && str2.is_null() {
396 return 0;
397 }
398 if str1.is_null() {
399 return -1;
400 }
401 if str2.is_null() {
402 return 1;
403 }
404 unsafe { libc::strcmp(str1 as *const c_char, str2 as *const c_char) as c_int }
405}
406
407/// Compare two xmlChar strings up to a given length.
408///
409/// # UPSTREAM-PARITY
410///
411/// ```c
412/// int xmlStrncmp(const xmlChar *str1, const xmlChar *str2, int len);
413/// ```
414#[no_mangle]
415pub unsafe extern "C" fn xmlStrncmp(
416 str1: *const xmlChar,
417 str2: *const xmlChar,
418 len: c_int,
419) -> c_int {
420 if len <= 0 {
421 return 0;
422 }
423 if str1.is_null() && str2.is_null() {
424 return 0;
425 }
426 if str1.is_null() {
427 return -1;
428 }
429 if str2.is_null() {
430 return 1;
431 }
432 unsafe { libc::strncmp(str1 as *const c_char, str2 as *const c_char, len as usize) as c_int }
433}
434
435/// Case-insensitive comparison of two xmlChar strings.
436///
437/// # UPSTREAM-PARITY
438///
439/// ```c
440/// int xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2);
441/// ```
442#[no_mangle]
443pub unsafe extern "C" fn xmlStrcasecmp(str1: *const xmlChar, str2: *const xmlChar) -> c_int {
444 if str1.is_null() && str2.is_null() {
445 return 0;
446 }
447 if str1.is_null() {
448 return -1;
449 }
450 if str2.is_null() {
451 return 1;
452 }
453 unsafe { libc::strcasecmp(str1 as *const c_char, str2 as *const c_char) as c_int }
454}
455
456/// Case-insensitive comparison with length limit.
457///
458/// # UPSTREAM-PARITY
459///
460/// ```c
461/// int xmlStrncasecmp(const xmlChar *str1, const xmlChar *str2, int len);
462/// ```
463#[no_mangle]
464pub unsafe extern "C" fn xmlStrncasecmp(
465 str1: *const xmlChar,
466 str2: *const xmlChar,
467 len: c_int,
468) -> c_int {
469 if len <= 0 {
470 return 0;
471 }
472 if str1.is_null() && str2.is_null() {
473 return 0;
474 }
475 if str1.is_null() {
476 return -1;
477 }
478 if str2.is_null() {
479 return 1;
480 }
481 unsafe {
482 libc::strncasecmp(str1 as *const c_char, str2 as *const c_char, len as usize) as c_int
483 }
484}
485
486/// Check if two xmlChar strings are equal.
487///
488/// # UPSTREAM-PARITY
489///
490/// ```c
491/// int xmlStrEqual(const xmlChar *str1, const xmlChar *str2);
492/// ```
493///
494/// Returns 1 if equal, 0 if not. NULL-safe.
495#[no_mangle]
496pub unsafe extern "C" fn xmlStrEqual(str1: *const xmlChar, str2: *const xmlChar) -> c_int {
497 if str1.is_null() && str2.is_null() {
498 return 1;
499 }
500 if str1.is_null() || str2.is_null() {
501 return 0;
502 }
503 unsafe { (libc::strcmp(str1 as *const c_char, str2 as *const c_char) == 0) as c_int }
504}
505
506/// Check if an xmlChar string equals a qualified name.
507///
508/// # UPSTREAM-PARITY
509///
510/// ```c
511/// int xmlStrQEqual(const xmlChar *pref, const xmlChar *name, const xmlChar *str);
512/// ```
513///
514/// Returns 1 if `pref:name` equals `str`, 0 otherwise.
515/// `pref` may be NULL (compares only name).
516#[no_mangle]
517pub unsafe extern "C" fn xmlStrQEqual(
518 pref: *const xmlChar,
519 name: *const xmlChar,
520 str: *const xmlChar,
521) -> c_int {
522 if name.is_null() || str.is_null() {
523 return 0;
524 }
525 if pref.is_null() {
526 return unsafe { xmlStrEqual(name, str) };
527 }
528 // Compare "pref:name" with str
529 let pref_len = unsafe { xmlStrlen(pref) };
530 let name_len = unsafe { xmlStrlen(name) };
531 let total_len = pref_len + 1 + name_len;
532 let str_len = unsafe { xmlStrlen(str) };
533 if total_len != str_len {
534 return 0;
535 }
536 // Compare prefix part
537 if unsafe {
538 libc::strncmp(
539 pref as *const c_char,
540 str as *const c_char,
541 pref_len as usize,
542 )
543 } != 0
544 {
545 return 0;
546 }
547 // Check colon
548 if unsafe { *str.add(pref_len as usize) } != b':' as xmlChar {
549 return 0;
550 }
551 // Compare name part
552 (unsafe {
553 libc::strncmp(
554 name as *const c_char,
555 str.add((pref_len + 1) as usize) as *const c_char,
556 name_len as usize,
557 ) == 0
558 }) as c_int
559}
560
561/// Concatenate two strings.
562///
563/// # UPSTREAM-PARITY
564///
565/// ```c
566/// xmlChar *xmlStrcat(xmlChar *cur, const xmlChar *add);
567/// ```
568///
569/// # SAFETY
570///
571/// - `cur` must be a valid xmlMalloc'd string or NULL.
572/// - `add` must be a valid string or NULL.
573/// - If `cur` is NULL, behaves like xmlStrdup(add).
574#[no_mangle]
575pub unsafe extern "C" fn xmlStrcat(cur: *mut xmlChar, add: *const xmlChar) -> *mut xmlChar {
576 if add.is_null() {
577 return cur;
578 }
579 if cur.is_null() {
580 return unsafe { xmlStrdup(add) };
581 }
582 let cur_len = unsafe { xmlStrlen(cur) } as usize;
583 let add_len = unsafe { xmlStrlen(add) } as usize;
584 let new_size = cur_len + add_len + 1;
585 let new_ptr = unsafe { xmlRealloc(cur as *mut c_void, new_size) };
586 if new_ptr.is_null() {
587 return ptr::null_mut();
588 }
589 unsafe {
590 ptr::copy_nonoverlapping(add as *const u8, (new_ptr as *mut u8).add(cur_len), add_len);
591 *((new_ptr as *mut u8).add(cur_len + add_len)) = 0;
592 }
593 new_ptr as *mut xmlChar
594}
595
596/// Concatenate up to `len` characters.
597///
598/// # UPSTREAM-PARITY
599///
600/// ```c
601/// xmlChar *xmlStrncat(xmlChar *cur, const xmlChar *add, int len);
602/// ```
603///
604/// # SAFETY
605///
606/// Same as xmlStrcat, but only copies up to `len` characters from `add`.
607#[no_mangle]
608pub unsafe extern "C" fn xmlStrncat(
609 cur: *mut xmlChar,
610 add: *const xmlChar,
611 len: c_int,
612) -> *mut xmlChar {
613 if add.is_null() || len <= 0 {
614 return cur;
615 }
616 let len = len as usize;
617 if cur.is_null() {
618 return unsafe { xmlStrndup(add, len as c_int) };
619 }
620 let cur_len = unsafe { xmlStrlen(cur) } as usize;
621 let new_size = cur_len + len + 1;
622 let new_ptr = unsafe { xmlRealloc(cur as *mut c_void, new_size) };
623 if new_ptr.is_null() {
624 return ptr::null_mut();
625 }
626 unsafe {
627 ptr::copy_nonoverlapping(add as *const u8, (new_ptr as *mut u8).add(cur_len), len);
628 *((new_ptr as *mut u8).add(cur_len + len)) = 0;
629 }
630 new_ptr as *mut xmlChar
631}
632
633/// Create a new string by concatenating up to `len` characters.
634///
635/// # UPSTREAM-PARITY
636///
637/// ```c
638/// xmlChar *xmlStrncatNew(const xmlChar *str1, const xmlChar *str2, int len);
639/// ```
640#[no_mangle]
641pub unsafe extern "C" fn xmlStrncatNew(
642 str1: *const xmlChar,
643 str2: *const xmlChar,
644 len: c_int,
645) -> *mut xmlChar {
646 let mut result: *mut xmlChar = ptr::null_mut();
647 if !str1.is_null() {
648 result = unsafe { xmlStrdup(str1) };
649 }
650 if !str2.is_null() && len > 0 {
651 result = unsafe { xmlStrncat(result, str2, len) };
652 }
653 result
654}
655
656/// Copy a string.
657///
658/// # UPSTREAM-PARITY
659///
660/// ```c
661/// xmlChar *xmlStrcpy(xmlChar *dst, const xmlChar *src);
662/// ```
663///
664/// # SAFETY
665///
666/// - `dst` must be a valid xmlMalloc'd buffer large enough to hold `src`.
667/// - `src` must be a valid string.
668#[no_mangle]
669pub unsafe extern "C" fn xmlStrcpy(dst: *mut xmlChar, src: *const xmlChar) -> *mut xmlChar {
670 if dst.is_null() || src.is_null() {
671 return dst;
672 }
673 let len = unsafe { xmlStrlen(src) } as usize + 1;
674 unsafe {
675 ptr::copy_nonoverlapping(src as *const u8, dst as *mut u8, len);
676 }
677 dst
678}
679
680/// Copy up to `len` characters.
681///
682/// # UPSTREAM-PARITY
683///
684/// ```c
685/// xmlChar *xmlStrncpy(xmlChar *dst, const xmlChar *src, int len);
686/// ```
687#[no_mangle]
688pub unsafe extern "C" fn xmlStrncpy(
689 dst: *mut xmlChar,
690 src: *const xmlChar,
691 len: c_int,
692) -> *mut xmlChar {
693 if dst.is_null() || src.is_null() || len <= 0 {
694 return dst;
695 }
696 let len = len as usize;
697 let src_len = unsafe { xmlStrlen(src) } as usize;
698 let copy_len = if src_len < len { src_len } else { len - 1 };
699 unsafe {
700 ptr::copy_nonoverlapping(src as *const u8, dst as *mut u8, copy_len);
701 *dst.add(copy_len) = 0;
702 }
703 dst
704}
705
706/// Extract a substring.
707///
708/// # UPSTREAM-PARITY
709///
710/// ```c
711/// xmlChar *xmlStrsub(const xmlChar *str, int start, int len);
712/// ```
713///
714/// Returns a newly allocated substring, or NULL on error.
715#[no_mangle]
716pub unsafe extern "C" fn xmlStrsub(str: *const xmlChar, start: c_int, len: c_int) -> *mut xmlChar {
717 if str.is_null() || start < 0 || len < 0 {
718 return ptr::null_mut();
719 }
720 let str_len = unsafe { xmlStrlen(str) };
721 if start >= str_len {
722 return unsafe { xmlStrdup(b"\0" as *const u8 as *const xmlChar) };
723 }
724 let actual_len = if start + len > str_len {
725 str_len - start
726 } else {
727 len
728 };
729 unsafe { xmlStrndup(str.add(start as usize), actual_len) }
730}
731
732// ═══════════════════════════════════════════════════════════════════════════════
733// 6. Tree — Document, Node, Attribute, Namespace, DTD, Entity
734// ═══════════════════════════════════════════════════════════════════════════════
735
736/// Create a new document.
737///
738/// # UPSTREAM-PARITY
739///
740/// ```c
741/// xmlDocPtr xmlNewDoc(const xmlChar *version);
742/// ```
743///
744/// # SAFETY
745///
746/// - `version` must be a valid string or NULL (defaults to "1.0").
747/// - Returns a newly allocated document. Caller must free with `xmlFreeDoc`.
748#[no_mangle]
749pub unsafe extern "C" fn xmlNewDoc(version: *const xmlChar) -> *mut _xmlDoc {
750 crate::xml::tree::new_doc(version)
751}
752
753/// Free a document.
754///
755/// # UPSTREAM-PARITY
756///
757/// ```c
758/// void xmlFreeDoc(xmlDocPtr doc);
759/// ```
760///
761/// # SAFETY
762///
763/// - `doc` must be a valid document pointer or NULL.
764#[no_mangle]
765pub unsafe extern "C" fn xmlFreeDoc(doc: *mut _xmlDoc) {
766 crate::xml::tree::free_doc(doc);
767}
768
769/// Create a new node.
770///
771/// # UPSTREAM-PARITY
772///
773/// ```c
774/// xmlNodePtr xmlNewNode(xmlNsPtr ns, const xmlChar *name);
775/// ```
776///
777/// # SAFETY
778///
779/// - `ns` may be NULL.
780/// - `name` must be a valid string.
781/// - Returns a newly allocated node. Caller must free with `xmlFreeNode`.
782#[no_mangle]
783pub unsafe extern "C" fn xmlNewNode(ns: *mut _xmlNs, name: *const xmlChar) -> *mut _xmlNode {
784 crate::xml::tree::new_node(ns, name)
785}
786
787/// Free a node.
788///
789/// # UPSTREAM-PARITY
790///
791/// ```c
792/// void xmlFreeNode(xmlNodePtr node);
793/// ```
794///
795/// # SAFETY
796///
797/// - `node` must be a valid node pointer or NULL.
798/// - The node must NOT be part of a document tree (must be unlinked first).
799#[no_mangle]
800pub unsafe extern "C" fn xmlFreeNode(node: *mut _xmlNode) {
801 crate::xml::tree::free_node(node);
802}
803
804/// Unlink a node from its tree.
805///
806/// # UPSTREAM-PARITY
807///
808/// ```c
809/// void xmlUnlinkNode(xmlNodePtr node);
810/// ```
811///
812/// # SAFETY
813///
814/// - `node` must be a valid node pointer or NULL.
815#[no_mangle]
816pub unsafe extern "C" fn xmlUnlinkNode(node: *mut _xmlNode) {
817 crate::xml::tree::unlink_node(node);
818}
819
820/// Add a child node.
821///
822/// # UPSTREAM-PARITY
823///
824/// ```c
825/// xmlNodePtr xmlAddChild(xmlNodePtr parent, xmlNodePtr cur);
826/// ```
827///
828/// # SAFETY
829///
830/// - `parent` must be a valid node.
831/// - `cur` must be a valid node (ownership transfers to parent).
832/// - Returns pointer to the added child (borrowed).
833#[no_mangle]
834pub unsafe extern "C" fn xmlAddChild(parent: *mut _xmlNode, cur: *mut _xmlNode) -> *mut _xmlNode {
835 crate::xml::tree::add_child(parent, cur)
836}
837
838/// Add a sibling node.
839///
840/// # UPSTREAM-PARITY
841///
842/// ```c
843/// xmlNodePtr xmlAddSibling(xmlNodePtr cur, xmlNodePtr sibling);
844/// ```
845///
846/// # SAFETY
847///
848/// Same as xmlAddChild, but adds after `cur` instead of as a child.
849#[no_mangle]
850pub unsafe extern "C" fn xmlAddSibling(
851 cur: *mut _xmlNode,
852 sibling: *mut _xmlNode,
853) -> *mut _xmlNode {
854 crate::xml::tree::add_sibling(cur, sibling)
855}
856
857/// Create a new child element.
858///
859/// # UPSTREAM-PARITY
860///
861/// ```c
862/// xmlNodePtr xmlNewChild(xmlNodePtr parent, xmlNsPtr ns,
863/// const xmlChar *name, const xmlChar *content);
864/// ```
865///
866/// Creates a new element node, adds it as a child of `parent`, and
867/// sets its content if `content` is non-NULL.
868///
869/// # SAFETY
870///
871/// - `parent` must be a valid node (may be NULL).
872/// - `ns` may be NULL.
873/// - `name` must be a valid string.
874/// - Returns a newly allocated node (owned by parent).
875#[no_mangle]
876pub unsafe extern "C" fn xmlNewChild(
877 parent: *mut _xmlNode,
878 ns: *mut _xmlNs,
879 name: *const xmlChar,
880 content: *const xmlChar,
881) -> *mut _xmlNode {
882 crate::xml::tree::new_child(parent, ns, name)
883}
884
885/// Set the root element of a document.
886///
887/// # UPSTREAM-PARITY
888///
889/// ```c
890/// xmlNodePtr xmlDocSetRootElement(xmlDocPtr doc, xmlNodePtr root);
891/// ```
892///
893/// Returns the old root element (if any), which the caller must free.
894///
895/// # SAFETY
896///
897/// - `doc` must be a valid document.
898/// - `root` must be a valid node (ownership transfers to doc).
899#[no_mangle]
900pub unsafe extern "C" fn xmlDocSetRootElement(
901 doc: *mut _xmlDoc,
902 root: *mut _xmlNode,
903) -> *mut _xmlNode {
904 crate::xml::tree::doc_set_root_element(doc, root)
905}
906
907/// Get the root element of a document.
908///
909/// # UPSTREAM-PARITY
910///
911/// ```c
912/// xmlNodePtr xmlDocGetRootElement(const xmlDoc *doc);
913/// ```
914///
915/// Returns a borrowed pointer (do not free).
916#[no_mangle]
917pub extern "C" fn xmlDocGetRootElement(doc: *const _xmlDoc) -> *mut _xmlNode {
918 crate::xml::tree::doc_get_root_element(doc as *mut _xmlDoc)
919}
920
921/// Copy a node.
922///
923/// # UPSTREAM-PARITY
924///
925/// ```c
926/// xmlNodePtr xmlCopyNode(const xmlNodePtr node, int extended);
927/// ```
928///
929/// If `extended` is 1, copies recursively (deep copy).
930/// If `extended` is 0, copies only the node itself (shallow copy).
931///
932/// Returns a newly allocated copy. Caller must free with `xmlFreeNode`.
933#[no_mangle]
934pub unsafe extern "C" fn xmlCopyNode(node: *const _xmlNode, extended: c_int) -> *mut _xmlNode {
935 crate::xml::tree::copy_node(node, extended)
936}
937
938/// Copy a document.
939///
940/// # UPSTREAM-PARITY
941///
942/// ```c
943/// xmlDocPtr xmlCopyDoc(const xmlDocPtr doc, int recursive);
944/// ```
945///
946/// Returns a newly allocated copy. Caller must free with `xmlFreeDoc`.
947#[no_mangle]
948pub unsafe extern "C" fn xmlCopyDoc(doc: *const _xmlDoc, recursive: c_int) -> *mut _xmlDoc {
949 crate::xml::tree::copy_doc(doc, recursive)
950}
951
952/// Create a text node.
953///
954/// # UPSTREAM-PARITY
955///
956/// ```c
957/// xmlNodePtr xmlNewText(const xmlChar *content);
958/// ```
959///
960/// Creates a new text node with the given content.
961/// If `content` is NULL, creates an empty text node.
962#[no_mangle]
963pub unsafe extern "C" fn xmlNewText(content: *const xmlChar) -> *mut _xmlNode {
964 crate::xml::tree::new_text(content)
965}
966
967/// Create a new comment node.
968///
969/// # UPSTREAM-PARITY
970///
971/// ```c
972/// xmlNodePtr xmlNewComment(const xmlChar *content);
973/// ```
974#[no_mangle]
975pub unsafe extern "C" fn xmlNewComment(content: *const xmlChar) -> *mut _xmlNode {
976 crate::xml::tree::new_comment(content)
977}
978
979/// Create a new PI node.
980///
981/// # UPSTREAM-PARITY
982///
983/// ```c
984/// xmlNodePtr xmlNewPI(const xmlChar *name, const xmlChar *content);
985/// ```
986#[no_mangle]
987pub unsafe extern "C" fn xmlNewPI(name: *const xmlChar, content: *const xmlChar) -> *mut _xmlNode {
988 crate::xml::tree::new_pi(name, content)
989}
990
991/// Create a new CDATA node.
992///
993/// # UPSTREAM-PARITY
994///
995/// ```c
996/// xmlNodePtr xmlNewCDataBlock(xmlDocPtr doc, const xmlChar *content, int len);
997/// ```
998#[no_mangle]
999pub unsafe extern "C" fn xmlNewCDataBlock(
1000 doc: *mut _xmlDoc,
1001 content: *const xmlChar,
1002 len: c_int,
1003) -> *mut _xmlNode {
1004 crate::xml::tree::new_cdata_block(doc, content, len)
1005}
1006
1007/// Create a new namespace definition.
1008///
1009/// # UPSTREAM-PARITY
1010///
1011/// ```c
1012/// xmlNsPtr xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix);
1013/// ```
1014///
1015/// # SAFETY
1016///
1017/// - `node` may be NULL.
1018/// - `href` and `prefix` are copied.
1019/// - Returns a borrowed pointer (namespace is owned by the node).
1020#[no_mangle]
1021pub unsafe extern "C" fn xmlNewNs(
1022 node: *mut _xmlNode,
1023 href: *const xmlChar,
1024 prefix: *const xmlChar,
1025) -> *mut _xmlNs {
1026 crate::xml::tree::new_ns(node, href, prefix)
1027}
1028
1029/// Set the namespace of a node.
1030///
1031/// # UPSTREAM-PARITY
1032///
1033/// ```c
1034/// void xmlSetNs(xmlNodePtr node, xmlNsPtr ns);
1035/// ```
1036#[no_mangle]
1037pub unsafe extern "C" fn xmlSetNs(node: *mut _xmlNode, ns: *mut _xmlNs) {
1038 crate::xml::tree::set_ns(node, ns);
1039}
1040
1041/// Get the namespace of a node.
1042///
1043/// # UPSTREAM-PARITY
1044///
1045/// ```c
1046/// xmlNsPtr xmlGetNsList(xmlDocPtr doc, const xmlNode *node);
1047/// ```
1048#[no_mangle]
1049pub unsafe extern "C" fn xmlGetNsList(
1050 doc: *mut _xmlDoc,
1051 node: *const _xmlNode,
1052) -> *mut *mut _xmlNs {
1053 crate::xml::tree::get_ns_list(doc, node as *mut _xmlNode)
1054}
1055
1056/// Search for a namespace by href.
1057///
1058/// # UPSTREAM-PARITY
1059///
1060/// ```c
1061/// xmlNsPtr xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace);
1062/// ```
1063#[no_mangle]
1064pub unsafe extern "C" fn xmlSearchNs(
1065 doc: *mut _xmlDoc,
1066 node: *mut _xmlNode,
1067 nameSpace: *const xmlChar,
1068) -> *mut _xmlNs {
1069 crate::xml::tree::search_ns(doc, node, nameSpace)
1070}
1071
1072/// Search for a namespace by href, using the full in-scope chain.
1073///
1074/// # UPSTREAM-PARITY
1075///
1076/// ```c
1077/// xmlNsPtr xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar *href);
1078/// ```
1079#[no_mangle]
1080pub unsafe extern "C" fn xmlSearchNsByHref(
1081 doc: *mut _xmlDoc,
1082 node: *mut _xmlNode,
1083 href: *const xmlChar,
1084) -> *mut _xmlNs {
1085 crate::xml::tree::search_ns_by_href(doc, node, href)
1086}
1087
1088/// Set a property (attribute) on a node.
1089///
1090/// # UPSTREAM-PARITY
1091///
1092/// ```c
1093/// xmlAttrPtr xmlSetProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value);
1094/// ```
1095///
1096/// If the attribute already exists, its value is updated.
1097/// Returns a borrowed pointer to the attribute.
1098///
1099/// # SAFETY
1100///
1101/// - `node` must be a valid element node.
1102/// - `name` must be a valid string.
1103/// - `value` may be NULL.
1104#[no_mangle]
1105pub unsafe extern "C" fn xmlSetProp(
1106 node: *mut _xmlNode,
1107 name: *const xmlChar,
1108 value: *const xmlChar,
1109) -> *mut _xmlAttr {
1110 crate::xml::tree::set_prop(node, name, value)
1111}
1112
1113/// Get a property value by name.
1114///
1115/// # UPSTREAM-PARITY
1116///
1117/// ```c
1118/// xmlChar *xmlGetProp(const xmlNode *node, const xmlChar *name);
1119/// ```
1120///
1121/// Returns a newly allocated string. Caller must free with `xmlFree`.
1122#[no_mangle]
1123pub unsafe extern "C" fn xmlGetProp(node: *const _xmlNode, name: *const xmlChar) -> *mut xmlChar {
1124 crate::xml::tree::get_prop(node as *mut _xmlNode, name)
1125}
1126
1127/// Get a namespaced property value.
1128///
1129/// # UPSTREAM-PARITY
1130///
1131/// ```c
1132/// xmlChar *xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace);
1133/// ```
1134#[no_mangle]
1135pub unsafe extern "C" fn xmlGetNsProp(
1136 node: *const _xmlNode,
1137 name: *const xmlChar,
1138 nameSpace: *const xmlChar,
1139) -> *mut xmlChar {
1140 crate::xml::tree::get_ns_prop(node as *mut _xmlNode, name, nameSpace)
1141}
1142
1143/// Set a namespaced property.
1144///
1145/// # UPSTREAM-PARITY
1146///
1147/// ```c
1148/// xmlAttrPtr xmlSetNsProp(xmlNodePtr node, xmlNsPtr ns,
1149/// const xmlChar *name, const xmlChar *value);
1150/// ```
1151#[no_mangle]
1152pub unsafe extern "C" fn xmlSetNsProp(
1153 node: *mut _xmlNode,
1154 ns: *mut _xmlNs,
1155 name: *const xmlChar,
1156 value: *const xmlChar,
1157) -> *mut _xmlAttr {
1158 crate::xml::tree::set_ns_prop(node, ns, name, value)
1159}
1160
1161/// Remove a property by name.
1162///
1163/// # UPSTREAM-PARITY
1164///
1165/// ```c
1166/// int xmlRemoveProp(xmlAttrPtr attr);
1167/// ```
1168///
1169/// Returns 0 on success, -1 on error.
1170#[no_mangle]
1171pub unsafe extern "C" fn xmlRemoveProp(attr: *mut _xmlAttr) -> c_int {
1172 crate::xml::tree::remove_prop(attr)
1173}
1174
1175/// Get a DTD from a document, creating one if needed.
1176///
1177/// # UPSTREAM-PARITY
1178///
1179/// ```c
1180/// xmlDtdPtr xmlGetIntSubset(const xmlDoc *doc);
1181/// ```
1182#[no_mangle]
1183pub extern "C" fn xmlGetIntSubset(doc: *const _xmlDoc) -> *mut _xmlDtd {
1184 crate::xml::tree::get_int_subset(doc)
1185}
1186
1187/// Create a new DTD.
1188///
1189/// # UPSTREAM-PARITY
1190///
1191/// ```c
1192/// xmlDtdPtr xmlNewDtd(xmlDocPtr doc, const xmlChar *name,
1193/// const xmlChar *ExternalID, const xmlChar *SystemID);
1194/// ```
1195#[no_mangle]
1196pub unsafe extern "C" fn xmlNewDtd(
1197 doc: *mut _xmlDoc,
1198 name: *const xmlChar,
1199 ExternalID: *const xmlChar,
1200 SystemID: *const xmlChar,
1201) -> *mut _xmlDtd {
1202 crate::xml::tree::new_dtd(doc, name, ExternalID, SystemID)
1203}
1204
1205/// Create a new entity.
1206///
1207/// # UPSTREAM-PARITY
1208///
1209/// ```c
1210/// xmlEntityPtr xmlNewEntity(xmlDocPtr doc, const xmlChar *name, int type,
1211/// const xmlChar *ExternalID, const xmlChar *SystemID,
1212/// const xmlChar *content);
1213/// ```
1214#[no_mangle]
1215pub unsafe extern "C" fn xmlNewEntity(
1216 doc: *mut _xmlDoc,
1217 name: *const xmlChar,
1218 type_: c_int,
1219 ExternalID: *const xmlChar,
1220 SystemID: *const xmlChar,
1221 content: *const xmlChar,
1222) -> *mut _xmlEntity {
1223 crate::xml::tree::new_entity(doc, name, type_, ExternalID, SystemID, content)
1224}
1225
1226/// Get an entity by name.
1227///
1228/// # UPSTREAM-PARITY
1229///
1230/// ```c
1231/// xmlEntityPtr xmlGetDocEntity(const xmlDoc *doc, const xmlChar *name);
1232/// ```
1233#[no_mangle]
1234pub unsafe extern "C" fn xmlGetDocEntity(
1235 doc: *const _xmlDoc,
1236 name: *const xmlChar,
1237) -> *mut _xmlEntity {
1238 crate::xml::tree::get_doc_entity(doc, name)
1239}
1240
1241/// Get a parameter entity by name.
1242///
1243/// # UPSTREAM-PARITY
1244///
1245/// ```c
1246/// xmlEntityPtr xmlGetParameterEntity(const xmlDoc *doc, const xmlChar *name);
1247/// ```
1248#[no_mangle]
1249pub unsafe extern "C" fn xmlGetParameterEntity(
1250 doc: *const _xmlDoc,
1251 name: *const xmlChar,
1252) -> *mut _xmlEntity {
1253 crate::xml::tree::get_parameter_entity(doc, name)
1254}
1255
1256/// Get the line number of a node.
1257///
1258/// # UPSTREAM-PARITY
1259///
1260/// ```c
1261/// long xmlGetLineNo(const xmlNode *node);
1262/// ```
1263#[no_mangle]
1264pub extern "C" fn xmlGetLineNo(node: *const _xmlNode) -> c_int {
1265 crate::xml::tree::get_line_no(node)
1266}
1267
1268// ═══════════════════════════════════════════════════════════════════════════════
1269// 7. Parser — SAX, DOM, Push, Reader
1270// ═══════════════════════════════════════════════════════════════════════════════
1271
1272/// Read an XML document from a string.
1273///
1274/// # UPSTREAM-PARITY
1275///
1276/// ```c
1277/// xmlDocPtr xmlReadDoc(const xmlChar *cur, const char *URL,
1278/// const char *encoding, int options);
1279/// ```
1280///
1281/// Returns a parsed document. Caller must free with `xmlFreeDoc`.
1282#[no_mangle]
1283pub unsafe extern "C" fn xmlReadDoc(
1284 cur: *const xmlChar,
1285 URL: *const c_char,
1286 encoding: *const c_char,
1287 options: c_int,
1288) -> *mut _xmlDoc {
1289 // Phase 1: STUB — will be implemented in xml/parser module.
1290 // For now, returns NULL to indicate parse failure.
1291 ptr::null_mut()
1292}
1293
1294/// Read an XML document from a file.
1295///
1296/// # UPSTREAM-PARITY
1297///
1298/// ```c
1299/// xmlDocPtr xmlReadFile(const char *URL, const char *encoding, int options);
1300/// ```
1301#[no_mangle]
1302pub unsafe extern "C" fn xmlReadFile(
1303 URL: *const c_char,
1304 encoding: *const c_char,
1305 options: c_int,
1306) -> *mut _xmlDoc {
1307 // Phase 1: STUB
1308 ptr::null_mut()
1309}
1310
1311/// Read an XML document from memory.
1312///
1313/// # UPSTREAM-PARITY
1314///
1315/// ```c
1316/// xmlDocPtr xmlReadMemory(const char *buffer, int size,
1317/// const char *URL, const char *encoding, int options);
1318/// ```
1319#[no_mangle]
1320pub unsafe extern "C" fn xmlReadMemory(
1321 buffer: *const c_char,
1322 size: c_int,
1323 URL: *const c_char,
1324 encoding: *const c_char,
1325 options: c_int,
1326) -> *mut _xmlDoc {
1327 // Phase 1: STUB
1328 ptr::null_mut()
1329}
1330
1331/// Read an XML document from a file descriptor.
1332///
1333/// # UPSTREAM-PARITY
1334///
1335/// ```c
1336/// xmlDocPtr xmlReadFd(int fd, const char *URL, const char *encoding, int options);
1337/// ```
1338#[no_mangle]
1339pub unsafe extern "C" fn xmlReadFd(
1340 fd: c_int,
1341 URL: *const c_char,
1342 encoding: *const c_char,
1343 options: c_int,
1344) -> *mut _xmlDoc {
1345 // Phase 1: STUB
1346 ptr::null_mut()
1347}
1348
1349/// Read an XML document from I/O callbacks.
1350///
1351/// # UPSTREAM-PARITY
1352///
1353/// ```c
1354/// xmlDocPtr xmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose,
1355/// void *ioctx, const char *URL, const char *encoding, int options);
1356/// ```
1357#[no_mangle]
1358pub unsafe extern "C" fn xmlReadIO(
1359 ioread: Option<xmlInputReadCallback>,
1360 ioclose: Option<xmlInputCloseCallback>,
1361 ioctx: *mut c_void,
1362 URL: *const c_char,
1363 encoding: *const c_char,
1364 options: c_int,
1365) -> *mut _xmlDoc {
1366 // Phase 1: STUB
1367 ptr::null_mut()
1368}
1369
1370/// Parse an XML document (SAX1).
1371///
1372/// # UPSTREAM-PARITY
1373///
1374/// ```c
1375/// xmlDocPtr xmlSAXParseDoc(xmlSAXHandlerPtr sax, const xmlChar *cur, int recovery);
1376/// ```
1377#[no_mangle]
1378pub unsafe extern "C" fn xmlSAXParseDoc(
1379 sax: *mut _xmlSAXHandler,
1380 cur: *const xmlChar,
1381 recovery: c_int,
1382) -> *mut _xmlDoc {
1383 // Phase 1: STUB
1384 ptr::null_mut()
1385}
1386
1387/// Parse an XML file (SAX1).
1388///
1389/// # UPSTREAM-PARITY
1390///
1391/// ```c
1392/// xmlDocPtr xmlSAXParseFile(xmlSAXHandlerPtr sax, const char *filename, int recovery);
1393/// ```
1394#[no_mangle]
1395pub unsafe extern "C" fn xmlSAXParseFile(
1396 sax: *mut _xmlSAXHandler,
1397 filename: *const c_char,
1398 recovery: c_int,
1399) -> *mut _xmlDoc {
1400 // Phase 1: STUB
1401 ptr::null_mut()
1402}
1403
1404/// Parse an XML document from memory (SAX1).
1405///
1406/// # UPSTREAM-PARITY
1407///
1408/// ```c
1409/// xmlDocPtr xmlSAXParseMemory(xmlSAXHandlerPtr sax,
1410/// const char *buffer, int size, int recovery);
1411/// ```
1412#[no_mangle]
1413pub unsafe extern "C" fn xmlSAXParseMemory(
1414 sax: *mut _xmlSAXHandler,
1415 buffer: *const c_char,
1416 size: c_int,
1417 recovery: c_int,
1418) -> *mut _xmlDoc {
1419 // Phase 1: STUB
1420 ptr::null_mut()
1421}
1422
1423/// SAX user parse file.
1424///
1425/// # UPSTREAM-PARITY
1426///
1427/// ```c
1428/// int xmlSAXUserParseFile(xmlSAXHandlerPtr sax, void *user_data,
1429/// const char *filename);
1430/// ```
1431#[no_mangle]
1432pub unsafe extern "C" fn xmlSAXUserParseFile(
1433 sax: *mut _xmlSAXHandler,
1434 user_data: *mut c_void,
1435 filename: *const c_char,
1436) -> c_int {
1437 // Phase 1: STUB
1438 -1
1439}
1440
1441/// SAX user parse memory.
1442///
1443/// # UPSTREAM-PARITY
1444///
1445/// ```c
1446/// int xmlSAXUserParseMemory(xmlSAXHandlerPtr sax, void *user_data,
1447/// const char *buffer, int size);
1448/// ```
1449#[no_mangle]
1450pub unsafe extern "C" fn xmlSAXUserParseMemory(
1451 sax: *mut _xmlSAXHandler,
1452 user_data: *mut c_void,
1453 buffer: *const c_char,
1454 size: c_int,
1455) -> c_int {
1456 // Phase 1: STUB
1457 -1
1458}
1459
1460/// Parse an XML document from a string (DOM).
1461///
1462/// # UPSTREAM-PARITY
1463///
1464/// ```c
1465/// xmlDocPtr xmlParseDoc(const xmlChar *cur);
1466/// ```
1467#[no_mangle]
1468pub unsafe extern "C" fn xmlParseDoc(cur: *const xmlChar) -> *mut _xmlDoc {
1469 // Phase 1: STUB
1470 ptr::null_mut()
1471}
1472
1473/// Parse an XML file (DOM).
1474///
1475/// # UPSTREAM-PARITY
1476///
1477/// ```c
1478/// xmlDocPtr xmlParseFile(const char *filename);
1479/// ```
1480#[no_mangle]
1481pub unsafe extern "C" fn xmlParseFile(filename: *const c_char) -> *mut _xmlDoc {
1482 // Phase 1: STUB
1483 ptr::null_mut()
1484}
1485
1486/// Parse an XML document from memory (DOM).
1487///
1488/// # UPSTREAM-PARITY
1489///
1490/// ```c
1491/// xmlDocPtr xmlParseMemory(const char *buffer, int size);
1492/// ```
1493#[no_mangle]
1494pub unsafe extern "C" fn xmlParseMemory(buffer: *const c_char, size: c_int) -> *mut _xmlDoc {
1495 // Phase 1: STUB
1496 ptr::null_mut()
1497}
1498
1499/// Create a file parser context.
1500///
1501/// # UPSTREAM-PARITY
1502///
1503/// ```c
1504/// xmlParserCtxtPtr xmlCreateFileParserCtxt(const char *filename);
1505/// ```
1506#[no_mangle]
1507pub unsafe extern "C" fn xmlCreateFileParserCtxt(filename: *const c_char) -> *mut _xmlParserCtxt {
1508 // Phase 1: STUB
1509 ptr::null_mut()
1510}
1511
1512/// Create a document parser context.
1513///
1514/// # UPSTREAM-PARITY
1515///
1516/// ```c
1517/// xmlParserCtxtPtr xmlCreateDocParserCtxt(const xmlChar *cur);
1518/// ```
1519#[no_mangle]
1520pub unsafe extern "C" fn xmlCreateDocParserCtxt(cur: *const xmlChar) -> *mut _xmlParserCtxt {
1521 // Phase 1: STUB
1522 ptr::null_mut()
1523}
1524
1525/// Parse a document using an existing parser context.
1526///
1527/// # UPSTREAM-PARITY
1528///
1529/// ```c
1530/// int xmlParseDocument(xmlParserCtxtPtr ctxt);
1531/// ```
1532#[no_mangle]
1533pub unsafe extern "C" fn xmlParseDocument(ctxt: *mut _xmlParserCtxt) -> c_int {
1534 // Phase 1: STUB
1535 -1
1536}
1537
1538/// Free a parser context.
1539///
1540/// # UPSTREAM-PARITY
1541///
1542/// ```c
1543/// void xmlFreeParserCtxt(xmlParserCtxtPtr ctxt);
1544/// ```
1545#[no_mangle]
1546pub unsafe extern "C" fn xmlFreeParserCtxt(ctxt: *mut _xmlParserCtxt) {
1547 if ctxt.is_null() {
1548 return;
1549 }
1550 // Phase 1: STUB — will be implemented in xml/parser module.
1551 unsafe {
1552 xmlFree(ctxt as *mut c_void);
1553 }
1554}
1555
1556/// Set parser options.
1557///
1558/// # UPSTREAM-PARITY
1559///
1560/// ```c
1561/// int xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options);
1562/// ```
1563#[no_mangle]
1564pub unsafe extern "C" fn xmlCtxtUseOptions(ctxt: *mut _xmlParserCtxt, options: c_int) -> c_int {
1565 if ctxt.is_null() {
1566 return -1;
1567 }
1568 // Phase 1: STUB
1569 unsafe {
1570 (*ctxt).options = options;
1571 }
1572 0
1573}
1574
1575/// Parse a well-balanced chunk (for push parsing).
1576///
1577/// # UPSTREAM-PARITY
1578///
1579/// ```c
1580/// xmlParserErrors xmlParseChunk(xmlParserCtxtPtr ctxt,
1581/// const char *chunk, int size, int terminate);
1582/// ```
1583#[no_mangle]
1584pub unsafe extern "C" fn xmlParseChunk(
1585 ctxt: *mut _xmlParserCtxt,
1586 chunk: *const c_char,
1587 size: c_int,
1588 terminate: c_int,
1589) -> c_int {
1590 // Phase 1: STUB
1591 -1
1592}
1593
1594/// Create a memory parser input buffer.
1595///
1596/// # UPSTREAM-PARITY
1597///
1598/// ```c
1599/// xmlParserInputBufferPtr xmlParserInputBufferCreateMem(const char *buffer, int size, int enc);
1600/// ```
1601#[no_mangle]
1602pub unsafe extern "C" fn xmlParserInputBufferCreateMem(
1603 buffer: *const c_char,
1604 size: c_int,
1605 enc: c_int,
1606) -> *mut _xmlParserInputBuffer {
1607 // Phase 1: STUB
1608 ptr::null_mut()
1609}
1610
1611/// Create a file parser input buffer.
1612///
1613/// # UPSTREAM-PARITY
1614///
1615/// ```c
1616/// xmlParserInputBufferPtr xmlParserInputBufferCreateFilename(const char *URI, int enc);
1617/// ```
1618#[no_mangle]
1619pub unsafe extern "C" fn xmlParserInputBufferCreateFilename(
1620 URI: *const c_char,
1621 enc: c_int,
1622) -> *mut _xmlParserInputBuffer {
1623 // Phase 1: STUB
1624 ptr::null_mut()
1625}
1626
1627/// Create an I/O parser input buffer.
1628///
1629/// # UPSTREAM-PARITY
1630///
1631/// ```c
1632/// xmlParserInputBufferPtr xmlParserInputBufferCreateIO(
1633/// xmlInputReadCallback ioread, xmlInputCloseCallback ioclose,
1634/// void *ioctx, int enc);
1635/// ```
1636#[no_mangle]
1637pub unsafe extern "C" fn xmlParserInputBufferCreateIO(
1638 ioread: Option<xmlInputReadCallback>,
1639 ioclose: Option<xmlInputCloseCallback>,
1640 ioctx: *mut c_void,
1641 enc: c_int,
1642) -> *mut _xmlParserInputBuffer {
1643 // Phase 1: STUB
1644 ptr::null_mut()
1645}
1646
1647/// Free a parser input buffer.
1648///
1649/// # UPSTREAM-PARITY
1650///
1651/// ```c
1652/// void xmlFreeParserInputBuffer(xmlParserInputBufferPtr buf);
1653/// ```
1654#[no_mangle]
1655pub unsafe extern "C" fn xmlFreeParserInputBuffer(buf: *mut _xmlParserInputBuffer) {
1656 if buf.is_null() {
1657 return;
1658 }
1659 // Phase 1: STUB
1660 unsafe {
1661 xmlFree(buf as *mut c_void);
1662 }
1663}
1664
1665/// Create a new parser input.
1666///
1667/// # UPSTREAM-PARITY
1668///
1669/// ```c
1670/// xmlParserInputPtr xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename);
1671/// ```
1672#[no_mangle]
1673pub unsafe extern "C" fn xmlNewInputFromFile(
1674 ctxt: *mut _xmlParserCtxt,
1675 filename: *const c_char,
1676) -> *mut _xmlParserInput {
1677 // Phase 1: STUB
1678 ptr::null_mut()
1679}
1680
1681/// Free a parser input.
1682///
1683/// # UPSTREAM-PARITY
1684///
1685/// ```c
1686/// void xmlFreeInputStream(xmlParserInputPtr input);
1687/// ```
1688#[no_mangle]
1689pub unsafe extern "C" fn xmlFreeInputStream(input: *mut _xmlParserInput) {
1690 if input.is_null() {
1691 return;
1692 }
1693 // Phase 1: STUB
1694 unsafe {
1695 xmlFree(input as *mut c_void);
1696 }
1697}
1698
1699// ═══════════════════════════════════════════════════════════════════════════════
1700// 8. I/O
1701// ═══════════════════════════════════════════════════════════════════════════════
1702
1703/// Create an output buffer for a file.
1704///
1705/// # UPSTREAM-PARITY
1706///
1707/// ```c
1708/// xmlOutputBufferPtr xmlOutputBufferCreateFilename(const char *URI,
1709/// xmlCharEncodingHandlerPtr encoder,
1710/// int compression);
1711/// ```
1712#[no_mangle]
1713pub unsafe extern "C" fn xmlOutputBufferCreateFilename(
1714 URI: *const c_char,
1715 encoder: *mut c_void,
1716 compression: c_int,
1717) -> *mut _xmlOutputBuffer {
1718 // Phase 1: STUB
1719 ptr::null_mut()
1720}
1721
1722/// Create an output buffer for a file descriptor.
1723///
1724/// # UPSTREAM-PARITY
1725///
1726/// ```c
1727/// xmlOutputBufferPtr xmlOutputBufferCreateFd(int fd,
1728/// xmlCharEncodingHandlerPtr encoder);
1729/// ```
1730#[no_mangle]
1731pub unsafe extern "C" fn xmlOutputBufferCreateFd(
1732 fd: c_int,
1733 encoder: *mut c_void,
1734) -> *mut _xmlOutputBuffer {
1735 // Phase 1: STUB
1736 ptr::null_mut()
1737}
1738
1739/// Create an output buffer from I/O callbacks.
1740///
1741/// # UPSTREAM-PARITY
1742///
1743/// ```c
1744/// xmlOutputBufferPtr xmlOutputBufferCreateIO(
1745/// xmlOutputWriteCallback iowrite, xmlOutputCloseCallback ioclose,
1746/// void *ioctx, xmlCharEncodingHandlerPtr encoder);
1747/// ```
1748#[no_mangle]
1749pub unsafe extern "C" fn xmlOutputBufferCreateIO(
1750 iowrite: Option<xmlOutputWriteCallback>,
1751 ioclose: Option<xmlOutputCloseCallback>,
1752 ioctx: *mut c_void,
1753 encoder: *mut c_void,
1754) -> *mut _xmlOutputBuffer {
1755 // Phase 1: STUB
1756 ptr::null_mut()
1757}
1758
1759/// Free an output buffer.
1760///
1761/// # UPSTREAM-PARITY
1762///
1763/// ```c
1764/// void xmlOutputBufferClose(xmlOutputBufferPtr out);
1765/// ```
1766#[no_mangle]
1767pub unsafe extern "C" fn xmlOutputBufferClose(out: *mut _xmlOutputBuffer) -> c_int {
1768 if out.is_null() {
1769 return 0;
1770 }
1771 // Phase 1: STUB
1772 unsafe {
1773 xmlFree(out as *mut c_void);
1774 }
1775 0
1776}
1777
1778/// Flush an output buffer.
1779///
1780/// # UPSTREAM-PARITY
1781///
1782/// ```c
1783/// int xmlOutputBufferFlush(xmlOutputBufferPtr out);
1784/// ```
1785#[no_mangle]
1786pub unsafe extern "C" fn xmlOutputBufferFlush(out: *mut _xmlOutputBuffer) -> c_int {
1787 // Phase 1: STUB
1788 0
1789}
1790
1791/// Write to an output buffer.
1792///
1793/// # UPSTREAM-PARITY
1794///
1795/// ```c
1796/// int xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *data);
1797/// ```
1798#[no_mangle]
1799pub unsafe extern "C" fn xmlOutputBufferWrite(
1800 out: *mut _xmlOutputBuffer,
1801 len: c_int,
1802 data: *const c_char,
1803) -> c_int {
1804 // Phase 1: STUB
1805 0
1806}
1807
1808/// Write a string to an output buffer.
1809///
1810/// # UPSTREAM-PARITY
1811///
1812/// ```c
1813/// int xmlOutputBufferWriteString(xmlOutputBufferPtr out, const char *str);
1814/// ```
1815#[no_mangle]
1816pub unsafe extern "C" fn xmlOutputBufferWriteString(
1817 out: *mut _xmlOutputBuffer,
1818 str: *const c_char,
1819) -> c_int {
1820 if str.is_null() {
1821 return 0;
1822 }
1823 unsafe { xmlOutputBufferWrite(out, xmlStrlen(str as *const xmlChar), str) }
1824}
1825
1826// ═══════════════════════════════════════════════════════════════════════════════
1827// 9. Dictionary
1828// ═══════════════════════════════════════════════════════════════════════════════
1829
1830/// Create a new dictionary.
1831///
1832/// # UPSTREAM-PARITY
1833///
1834/// ```c
1835/// xmlDictPtr xmlDictCreate(void);
1836/// ```
1837#[no_mangle]
1838pub extern "C" fn xmlDictCreate() -> *mut c_void {
1839 // Phase 1: STUB — will be implemented in xml/dictionary module.
1840 ptr::null_mut()
1841}
1842
1843/// Create a sub-dictionary.
1844///
1845/// # UPSTREAM-PARITY
1846///
1847/// ```c
1848/// xmlDictPtr xmlDictCreateSub(xmlDictPtr sub);
1849/// ```
1850#[no_mangle]
1851pub extern "C" fn xmlDictCreateSub(_sub: *mut c_void) -> *mut c_void {
1852 // Phase 1: STUB
1853 ptr::null_mut()
1854}
1855
1856/// Look up a string in the dictionary.
1857///
1858/// # UPSTREAM-PARITY
1859///
1860/// ```c
1861/// const xmlChar *xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len);
1862/// ```
1863///
1864/// Returns an interned string pointer (valid as long as the dictionary exists).
1865/// - If `len` < 0, `name` must be null-terminated.
1866/// - If `len` >= 0, exactly `len` bytes are used.
1867#[no_mangle]
1868pub unsafe extern "C" fn xmlDictLookup(
1869 dict: *mut c_void,
1870 name: *const xmlChar,
1871 len: c_int,
1872) -> *const xmlChar {
1873 // Phase 1: STUB
1874 name
1875}
1876
1877/// Check if a string exists in the dictionary.
1878///
1879/// # UPSTREAM-PARITY
1880///
1881/// ```c
1882/// const xmlChar *xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len);
1883/// ```
1884#[no_mangle]
1885pub unsafe extern "C" fn xmlDictExists(
1886 dict: *mut c_void,
1887 name: *const xmlChar,
1888 len: c_int,
1889) -> *const xmlChar {
1890 // Phase 1: STUB
1891 ptr::null()
1892}
1893
1894/// Query dictionary size.
1895///
1896/// # UPSTREAM-PARITY
1897///
1898/// ```c
1899/// unsigned int xmlDictSize(const xmlDictPtr dict);
1900/// ```
1901#[no_mangle]
1902pub extern "C" fn xmlDictSize(dict: *const c_void) -> c_uint {
1903 // Phase 1: STUB
1904 0
1905}
1906
1907/// Free a dictionary.
1908///
1909/// # UPSTREAM-PARITY
1910///
1911/// ```c
1912/// void xmlDictFree(xmlDictPtr dict);
1913/// ```
1914#[no_mangle]
1915pub extern "C" fn xmlDictFree(_dict: *mut c_void) {
1916 // Phase 1: STUB
1917}
1918
1919/// Set the dictionary size limit.
1920///
1921/// # UPSTREAM-PARITY
1922///
1923/// ```c
1924/// unsigned int xmlDictSetLimit(xmlDictPtr dict, unsigned int limit);
1925/// ```
1926#[no_mangle]
1927pub extern "C" fn xmlDictSetLimit(_dict: *mut c_void, _limit: c_uint) -> c_uint {
1928 // Phase 1: STUB
1929 0
1930}
1931
1932/// Get current dictionary usage.
1933///
1934/// # UPSTREAM-PARITY
1935///
1936/// ```c
1937/// unsigned int xmlDictGetUsage(const xmlDictPtr dict);
1938/// ```
1939#[no_mangle]
1940pub extern "C" fn xmlDictGetUsage(_dict: *const c_void) -> c_uint {
1941 // Phase 1: STUB
1942 0
1943}
1944
1945// ═══════════════════════════════════════════════════════════════════════════════
1946// 10. Hash Table
1947// ═══════════════════════════════════════════════════════════════════════════════
1948
1949/// Create a new hash table.
1950///
1951/// # UPSTREAM-PARITY
1952///
1953/// ```c
1954/// xmlHashTablePtr xmlHashCreate(int size);
1955/// ```
1956#[no_mangle]
1957pub extern "C" fn xmlHashCreate(_size: c_int) -> *mut c_void {
1958 // Phase 1: STUB
1959 ptr::null_mut()
1960}
1961
1962/// Create a new hash table with a dictionary.
1963///
1964/// # UPSTREAM-PARITY
1965///
1966/// ```c
1967/// xmlHashTablePtr xmlHashCreateDict(int size, xmlDictPtr dict);
1968/// ```
1969#[no_mangle]
1970pub extern "C" fn xmlHashCreateDict(_size: c_int, _dict: *mut c_void) -> *mut c_void {
1971 // Phase 1: STUB
1972 ptr::null_mut()
1973}
1974
1975/// Free a hash table.
1976///
1977/// # UPSTREAM-PARITY
1978///
1979/// ```c
1980/// void xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f);
1981/// ```
1982#[no_mangle]
1983pub extern "C" fn xmlHashFree(
1984 _table: *mut c_void,
1985 _f: Option<unsafe extern "C" fn(*mut c_void, *mut xmlChar)>,
1986) {
1987 // Phase 1: STUB
1988}
1989
1990/// Add an entry to a hash table.
1991///
1992/// # UPSTREAM-PARITY
1993///
1994/// ```c
1995/// int xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata);
1996/// ```
1997#[no_mangle]
1998pub unsafe extern "C" fn xmlHashAddEntry(
1999 _table: *mut c_void,
2000 _name: *const xmlChar,
2001 _userdata: *mut c_void,
2002) -> c_int {
2003 // Phase 1: STUB
2004 0
2005}
2006
2007/// Add a 2-key entry.
2008///
2009/// # UPSTREAM-PARITY
2010///
2011/// ```c
2012/// int xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name,
2013/// const xmlChar *name2, void *userdata);
2014/// ```
2015#[no_mangle]
2016pub unsafe extern "C" fn xmlHashAddEntry2(
2017 _table: *mut c_void,
2018 _name: *const xmlChar,
2019 _name2: *const xmlChar,
2020 _userdata: *mut c_void,
2021) -> c_int {
2022 // Phase 1: STUB
2023 0
2024}
2025
2026/// Add a 3-key entry.
2027///
2028/// # UPSTREAM-PARITY
2029///
2030/// ```c
2031/// int xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
2032/// const xmlChar *name2, const xmlChar *name3, void *userdata);
2033/// ```
2034#[no_mangle]
2035pub unsafe extern "C" fn xmlHashAddEntry3(
2036 _table: *mut c_void,
2037 _name: *const xmlChar,
2038 _name2: *const xmlChar,
2039 _name3: *const xmlChar,
2040 _userdata: *mut c_void,
2041) -> c_int {
2042 // Phase 1: STUB
2043 0
2044}
2045
2046/// Update or add an entry.
2047///
2048/// # UPSTREAM-PARITY
2049///
2050/// ```c
2051/// int xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name,
2052/// void *userdata, xmlHashDeallocator f);
2053/// ```
2054#[no_mangle]
2055pub unsafe extern "C" fn xmlHashUpdateEntry(
2056 _table: *mut c_void,
2057 _name: *const xmlChar,
2058 _userdata: *mut c_void,
2059 _f: Option<unsafe extern "C" fn(*mut c_void, *mut xmlChar)>,
2060) -> c_int {
2061 // Phase 1: STUB
2062 0
2063}
2064
2065/// Update or add a 2-key entry.
2066#[no_mangle]
2067pub unsafe extern "C" fn xmlHashUpdateEntry2(
2068 _table: *mut c_void,
2069 _name: *const xmlChar,
2070 _name2: *const xmlChar,
2071 _userdata: *mut c_void,
2072 _f: Option<unsafe extern "C" fn(*mut c_void, *mut xmlChar)>,
2073) -> c_int {
2074 // Phase 1: STUB
2075 0
2076}
2077
2078/// Update or add a 3-key entry.
2079#[no_mangle]
2080pub unsafe extern "C" fn xmlHashUpdateEntry3(
2081 _table: *mut c_void,
2082 _name: *const xmlChar,
2083 _name2: *const xmlChar,
2084 _name3: *const xmlChar,
2085 _userdata: *mut c_void,
2086 _f: Option<unsafe extern "C" fn(*mut c_void, *mut xmlChar)>,
2087) -> c_int {
2088 // Phase 1: STUB
2089 0
2090}
2091
2092/// Look up an entry.
2093///
2094/// # UPSTREAM-PARITY
2095///
2096/// ```c
2097/// void *xmlHashLookup(xmlHashTablePtr table, const xmlChar *name);
2098/// ```
2099#[no_mangle]
2100pub unsafe extern "C" fn xmlHashLookup(_table: *mut c_void, _name: *const xmlChar) -> *mut c_void {
2101 // Phase 1: STUB
2102 ptr::null_mut()
2103}
2104
2105/// Look up a 2-key entry.
2106#[no_mangle]
2107pub unsafe extern "C" fn xmlHashLookup2(
2108 _table: *mut c_void,
2109 _name: *const xmlChar,
2110 _name2: *const xmlChar,
2111) -> *mut c_void {
2112 // Phase 1: STUB
2113 ptr::null_mut()
2114}
2115
2116/// Look up a 3-key entry.
2117#[no_mangle]
2118pub unsafe extern "C" fn xmlHashLookup3(
2119 _table: *mut c_void,
2120 _name: *const xmlChar,
2121 _name2: *const xmlChar,
2122 _name3: *const xmlChar,
2123) -> *mut c_void {
2124 // Phase 1: STUB
2125 ptr::null_mut()
2126}
2127
2128/// Get the size of a hash table.
2129///
2130/// # UPSTREAM-PARITY
2131///
2132/// ```c
2133/// int xmlHashSize(xmlHashTablePtr table);
2134/// ```
2135#[no_mangle]
2136pub extern "C" fn xmlHashSize(_table: *mut c_void) -> c_int {
2137 // Phase 1: STUB
2138 0
2139}
2140
2141/// Remove an entry.
2142///
2143/// # UPSTREAM-PARITY
2144///
2145/// ```c
2146/// int xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
2147/// xmlHashDeallocator f);
2148/// ```
2149#[no_mangle]
2150pub unsafe extern "C" fn xmlHashRemoveEntry(
2151 _table: *mut c_void,
2152 _name: *const xmlChar,
2153 _f: Option<unsafe extern "C" fn(*mut c_void, *mut xmlChar)>,
2154) -> c_int {
2155 // Phase 1: STUB
2156 0
2157}
2158
2159/// Remove a 2-key entry.
2160#[no_mangle]
2161pub unsafe extern "C" fn xmlHashRemoveEntry2(
2162 _table: *mut c_void,
2163 _name: *const xmlChar,
2164 _name2: *const xmlChar,
2165 _f: Option<unsafe extern "C" fn(*mut c_void, *mut xmlChar)>,
2166) -> c_int {
2167 // Phase 1: STUB
2168 0
2169}
2170
2171/// Remove a 3-key entry.
2172#[no_mangle]
2173pub unsafe extern "C" fn xmlHashRemoveEntry3(
2174 _table: *mut c_void,
2175 _name: *const xmlChar,
2176 _name2: *const xmlChar,
2177 _name3: *const xmlChar,
2178 _f: Option<unsafe extern "C" fn(*mut c_void, *mut xmlChar)>,
2179) -> c_int {
2180 // Phase 1: STUB
2181 0
2182}
2183
2184/// Scan a hash table with a scanner function.
2185///
2186/// # UPSTREAM-PARITY
2187///
2188/// ```c
2189/// void xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data);
2190/// ```
2191#[no_mangle]
2192pub extern "C" fn xmlHashScan(
2193 _table: *mut c_void,
2194 _f: Option<unsafe extern "C" fn(*mut c_void, *const xmlChar, *mut c_void)>,
2195 _data: *mut c_void,
2196) {
2197 // Phase 1: STUB
2198}
2199
2200/// Scan a hash table with a full scanner function.
2201#[no_mangle]
2202pub extern "C" fn xmlHashScanFull(
2203 _table: *mut c_void,
2204 _f: Option<unsafe extern "C" fn(*mut c_void, *const xmlChar, *mut c_void, *mut c_void)>,
2205 _data: *mut c_void,
2206) {
2207 // Phase 1: STUB
2208}
2209
2210/// Copy a hash table.
2211///
2212/// # UPSTREAM-PARITY
2213///
2214/// ```c
2215/// xmlHashTablePtr xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f);
2216/// ```
2217#[no_mangle]
2218pub extern "C" fn xmlHashCopy(
2219 _table: *mut c_void,
2220 _f: Option<unsafe extern "C" fn(*mut c_void, *const xmlChar) -> *mut c_void>,
2221) -> *mut c_void {
2222 // Phase 1: STUB
2223 ptr::null_mut()
2224}
2225
2226// ═══════════════════════════════════════════════════════════════════════════════
2227// 11. List
2228// ═══════════════════════════════════════════════════════════════════════════════
2229
2230/// Create a new list.
2231///
2232/// # UPSTREAM-PARITY
2233///
2234/// ```c
2235/// xmlListPtr xmlListCreate(xmlListDeallocator deallocator,
2236/// xmlListDataCompare compare);
2237/// ```
2238#[no_mangle]
2239pub extern "C" fn xmlListCreate(
2240 _deallocator: Option<unsafe extern "C" fn(*mut c_void)>,
2241 _compare: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
2242) -> *mut c_void {
2243 // Phase 1: STUB
2244 ptr::null_mut()
2245}
2246
2247/// Delete a list.
2248///
2249/// # UPSTREAM-PARITY
2250///
2251/// ```c
2252/// void xmlListDelete(xmlListPtr list);
2253/// ```
2254#[no_mangle]
2255pub extern "C" fn xmlListDelete(_list: *mut c_void) {
2256 // Phase 1: STUB
2257}
2258
2259/// Search a list.
2260///
2261/// # UPSTREAM-PARITY
2262///
2263/// ```c
2264/// void *xmlListSearch(xmlListPtr list, void *data);
2265/// ```
2266#[no_mangle]
2267pub extern "C" fn xmlListSearch(_list: *mut c_void, _data: *mut c_void) -> *mut c_void {
2268 // Phase 1: STUB
2269 ptr::null_mut()
2270}
2271
2272/// Walk a list.
2273///
2274/// # UPSTREAM-PARITY
2275///
2276/// ```c
2277/// void xmlListWalk(xmlListPtr list, xmlListWalker walker, void *data);
2278/// ```
2279#[no_mangle]
2280pub extern "C" fn xmlListWalk(
2281 _list: *mut c_void,
2282 _walker: Option<unsafe extern "C" fn(*mut c_void, *mut c_void) -> c_int>,
2283 _data: *mut c_void,
2284) {
2285 // Phase 1: STUB
2286}
2287
2288/// Push to back.
2289///
2290/// # UPSTREAM-PARITY
2291///
2292/// ```c
2293/// int xmlListPushBack(xmlListPtr list, void *data);
2294/// ```
2295#[no_mangle]
2296pub extern "C" fn xmlListPushBack(_list: *mut c_void, _data: *mut c_void) -> c_int {
2297 // Phase 1: STUB
2298 0
2299}
2300
2301/// Push to front.
2302///
2303/// # UPSTREAM-PARITY
2304///
2305/// ```c
2306/// int xmlListPushFront(xmlListPtr list, void *data);
2307/// ```
2308#[no_mangle]
2309pub extern "C" fn xmlListPushFront(_list: *mut c_void, _data: *mut c_void) -> c_int {
2310 // Phase 1: STUB
2311 0
2312}
2313
2314/// Pop from back.
2315#[no_mangle]
2316pub extern "C" fn xmlListPopBack(_list: *mut c_void) {
2317 // Phase 1: STUB
2318}
2319
2320/// Pop from front.
2321#[no_mangle]
2322pub extern "C" fn xmlListPopFront(_list: *mut c_void) {
2323 // Phase 1: STUB
2324}
2325
2326/// Insert into sorted list.
2327///
2328/// # UPSTREAM-PARITY
2329///
2330/// ```c
2331/// int xmlListInsert(xmlListPtr list, void *data);
2332/// ```
2333#[no_mangle]
2334pub extern "C" fn xmlListInsert(_list: *mut c_void, _data: *mut c_void) -> c_int {
2335 // Phase 1: STUB
2336 0
2337}
2338
2339/// Append to list.
2340#[no_mangle]
2341pub extern "C" fn xmlListAppend(_list: *mut c_void, _data: *mut c_void) -> c_int {
2342 // Phase 1: STUB
2343 0
2344}
2345
2346/// Remove first matching element.
2347#[no_mangle]
2348pub extern "C" fn xmlListRemoveFirst(_list: *mut c_void, _data: *mut c_void) -> c_int {
2349 // Phase 1: STUB
2350 0
2351}
2352
2353/// Remove last matching element.
2354#[no_mangle]
2355pub extern "C" fn xmlListRemoveLast(_list: *mut c_void, _data: *mut c_void) -> c_int {
2356 // Phase 1: STUB
2357 0
2358}
2359
2360/// Remove all matching elements.
2361#[no_mangle]
2362pub extern "C" fn xmlListRemoveAll(_list: *mut c_void, _data: *mut c_void) -> c_int {
2363 // Phase 1: STUB
2364 0
2365}
2366
2367/// Clear a list.
2368#[no_mangle]
2369pub extern "C" fn xmlListClear(_list: *mut c_void) {
2370 // Phase 1: STUB
2371}
2372
2373/// Check if list is empty.
2374///
2375/// # UPSTREAM-PARITY
2376///
2377/// ```c
2378/// int xmlListEmpty(xmlListPtr list);
2379/// ```
2380#[no_mangle]
2381pub extern "C" fn xmlListEmpty(_list: *mut c_void) -> c_int {
2382 // Phase 1: STUB
2383 1
2384}
2385
2386/// Get front element.
2387///
2388/// # UPSTREAM-PARITY
2389///
2390/// ```c
2391/// void *xmlListFront(xmlListPtr list);
2392/// ```
2393#[no_mangle]
2394pub extern "C" fn xmlListFront(_list: *mut c_void) -> *mut c_void {
2395 // Phase 1: STUB
2396 ptr::null_mut()
2397}
2398
2399/// Get back element.
2400///
2401/// # UPSTREAM-PARITY
2402///
2403/// ```c
2404/// void *xmlListBack(xmlListPtr list);
2405/// ```
2406#[no_mangle]
2407pub extern "C" fn xmlListBack(_list: *mut c_void) -> *mut c_void {
2408 // Phase 1: STUB
2409 ptr::null_mut()
2410}
2411
2412/// Get list size.
2413///
2414/// # UPSTREAM-PARITY
2415///
2416/// ```c
2417/// int xmlListSize(xmlListPtr list);
2418/// ```
2419#[no_mangle]
2420pub extern "C" fn xmlListSize(_list: *mut c_void) -> c_int {
2421 // Phase 1: STUB
2422 0
2423}
2424
2425/// Sort a list.
2426#[no_mangle]
2427pub extern "C" fn xmlListSort(_list: *mut c_void) {
2428 // Phase 1: STUB
2429}
2430
2431/// Reverse a list.
2432#[no_mangle]
2433pub extern "C" fn xmlListReverse(_list: *mut c_void) {
2434 // Phase 1: STUB
2435}
2436
2437/// Reverse a list in-place.
2438#[no_mangle]
2439pub extern "C" fn xmlListReverseSplice(_list: *mut c_void, _list2: *mut c_void) {
2440 // Phase 1: STUB
2441}
2442
2443/// Merge two sorted lists.
2444#[no_mangle]
2445pub extern "C" fn xmlListMerge(_list: *mut c_void, _list2: *mut c_void) {
2446 // Phase 1: STUB
2447}
2448
2449// ═══════════════════════════════════════════════════════════════════════════════
2450// 12. Buffer
2451// ═══════════════════════════════════════════════════════════════════════════════
2452
2453/// Create a new buffer.
2454///
2455/// # UPSTREAM-PARITY
2456///
2457/// ```c
2458/// xmlBufferPtr xmlBufferCreate(void);
2459/// ```
2460#[no_mangle]
2461pub extern "C" fn xmlBufferCreate() -> *mut _xmlBuffer {
2462 // Phase 1: STUB
2463 ptr::null_mut()
2464}
2465
2466/// Create a new buffer of a given size.
2467///
2468/// # UPSTREAM-PARITY
2469///
2470/// ```c
2471/// xmlBufferPtr xmlBufferCreateSize(size_t size);
2472/// ```
2473#[no_mangle]
2474pub extern "C" fn xmlBufferCreateSize(_size: usize) -> *mut _xmlBuffer {
2475 // Phase 1: STUB
2476 ptr::null_mut()
2477}
2478
2479/// Create a buffer from a static string.
2480///
2481/// # UPSTREAM-PARITY
2482///
2483/// ```c
2484/// xmlBufferPtr xmlBufferCreateStatic(void *mem, size_t size);
2485/// ```
2486#[no_mangle]
2487pub extern "C" fn xmlBufferCreateStatic(_mem: *mut c_void, _size: usize) -> *mut _xmlBuffer {
2488 // Phase 1: STUB
2489 ptr::null_mut()
2490}
2491
2492/// Free a buffer.
2493///
2494/// # UPSTREAM-PARITY
2495///
2496/// ```c
2497/// void xmlBufferFree(xmlBufferPtr buf);
2498/// ```
2499#[no_mangle]
2500pub extern "C" fn xmlBufferFree(_buf: *mut _xmlBuffer) {
2501 // Phase 1: STUB
2502}
2503
2504/// Empty a buffer.
2505///
2506/// # UPSTREAM-PARITY
2507///
2508/// ```c
2509/// void xmlBufferEmpty(xmlBufferPtr buf);
2510/// ```
2511#[no_mangle]
2512pub extern "C" fn xmlBufferEmpty(_buf: *mut _xmlBuffer) {
2513 // Phase 1: STUB
2514}
2515
2516/// Get buffer content.
2517///
2518/// # UPSTREAM-PARITY
2519///
2520/// ```c
2521/// xmlChar *xmlBufferContent(const xmlBuffer *buf);
2522/// ```
2523#[no_mangle]
2524pub extern "C" fn xmlBufferContent(_buf: *const _xmlBuffer) -> *mut xmlChar {
2525 // Phase 1: STUB
2526 ptr::null_mut()
2527}
2528
2529/// Get buffer length.
2530///
2531/// # UPSTREAM-PARITY
2532///
2533/// ```c
2534/// int xmlBufferLength(const xmlBuffer *buf);
2535/// ```
2536#[no_mangle]
2537pub extern "C" fn xmlBufferLength(_buf: *const _xmlBuffer) -> c_int {
2538 // Phase 1: STUB
2539 0
2540}
2541
2542/// Write to a buffer.
2543///
2544/// # UPSTREAM-PARITY
2545///
2546/// ```c
2547/// int xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len);
2548/// ```
2549#[no_mangle]
2550pub unsafe extern "C" fn xmlBufferAdd(
2551 _buf: *mut _xmlBuffer,
2552 _str: *const xmlChar,
2553 _len: c_int,
2554) -> c_int {
2555 // Phase 1: STUB
2556 0
2557}
2558
2559/// Write to a buffer at a position.
2560///
2561/// # UPSTREAM-PARITY
2562///
2563/// ```c
2564/// int xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len);
2565/// ```
2566#[no_mangle]
2567pub unsafe extern "C" fn xmlBufferAddHead(
2568 _buf: *mut _xmlBuffer,
2569 _str: *const xmlChar,
2570 _len: c_int,
2571) -> c_int {
2572 // Phase 1: STUB
2573 0
2574}
2575
2576/// Set buffer allocation scheme.
2577///
2578/// # UPSTREAM-PARITY
2579///
2580/// ```c
2581/// void xmlBufferSetAllocationScheme(xmlBufferPtr buf,
2582/// xmlBufferAllocationScheme scheme);
2583/// ```
2584#[no_mangle]
2585pub extern "C" fn xmlBufferSetAllocationScheme(_buf: *mut _xmlBuffer, _scheme: c_int) {
2586 // Phase 1: STUB
2587}
2588
2589/// Shrink buffer.
2590///
2591/// # UPSTREAM-PARITY
2592///
2593/// ```c
2594/// int xmlBufferShrink(xmlBufferPtr buf, int len);
2595/// ```
2596#[no_mangle]
2597pub extern "C" fn xmlBufferShrink(_buf: *mut _xmlBuffer, _len: c_int) -> c_int {
2598 // Phase 1: STUB
2599 0
2600}
2601
2602/// Grow buffer.
2603///
2604/// # UPSTREAM-PARITY
2605///
2606/// ```c
2607/// int xmlBufferGrow(xmlBufferPtr buf, int len);
2608/// ```
2609#[no_mangle]
2610pub extern "C" fn xmlBufferGrow(_buf: *mut _xmlBuffer, _len: c_int) -> c_int {
2611 // Phase 1: STUB
2612 0
2613}
2614
2615/// Reserve buffer space.
2616///
2617/// # UPSTREAM-PARITY
2618///
2619/// ```c
2620/// int xmlBufferReserve(xmlBufferPtr buf, int len);
2621/// ```
2622#[no_mangle]
2623pub extern "C" fn xmlBufferReserve(_buf: *mut _xmlBuffer, _len: c_int) -> c_int {
2624 // Phase 1: STUB
2625 0
2626}
2627
2628/// Detach buffer content.
2629///
2630/// # UPSTREAM-PARITY
2631///
2632/// ```c
2633/// xmlChar *xmlBufferDetach(xmlBufferPtr buf);
2634/// ```
2635#[no_mangle]
2636pub extern "C" fn xmlBufferDetach(_buf: *mut _xmlBuffer) -> *mut xmlChar {
2637 // Phase 1: STUB
2638 ptr::null_mut()
2639}
2640
2641// ═══════════════════════════════════════════════════════════════════════════════
2642// 13. Encoding
2643// ═══════════════════════════════════════════════════════════════════════════════
2644
2645/// Get encoding from a name string.
2646///
2647/// # UPSTREAM-PARITY
2648///
2649/// ```c
2650/// xmlCharEncoding xmlGetCharEncoding(const char *name);
2651/// ```
2652#[no_mangle]
2653pub extern "C" fn xmlGetCharEncoding(_name: *const c_char) -> c_int {
2654 // Phase 1: STUB
2655 // Return XML_CHAR_ENCODING_NONE = 0
2656 0
2657}
2658
2659/// Find an encoding handler.
2660///
2661/// # UPSTREAM-PARITY
2662///
2663/// ```c
2664/// xmlCharEncodingHandlerPtr xmlFindCharEncodingHandler(const char *name);
2665/// ```
2666#[no_mangle]
2667pub extern "C" fn xmlFindCharEncodingHandler(_name: *const c_char) -> *mut c_void {
2668 // Phase 1: STUB
2669 ptr::null_mut()
2670}
2671
2672/// Close an encoding handler.
2673///
2674/// # UPSTREAM-PARITY
2675///
2676/// ```c
2677/// int xmlCharEncCloseFunc(xmlCharEncodingHandlerPtr handler);
2678/// ```
2679#[no_mangle]
2680pub extern "C" fn xmlCharEncCloseFunc(_handler: *mut c_void) -> c_int {
2681 // Phase 1: STUB
2682 0
2683}
2684
2685/// Convert an input buffer's encoding.
2686///
2687/// # UPSTREAM-PARITY
2688///
2689/// ```c
2690/// int xmlCharEncInput(xmlParserInputBufferPtr input, int to);
2691/// ```
2692#[no_mangle]
2693pub extern "C" fn xmlCharEncInput(_input: *mut _xmlParserInputBuffer, _to: c_int) -> c_int {
2694 // Phase 1: STUB
2695 0
2696}
2697
2698/// Convert an output buffer's encoding.
2699///
2700/// # UPSTREAM-PARITY
2701///
2702/// ```c
2703/// int xmlCharEncOutput(xmlOutputBufferPtr output, int to);
2704/// ```
2705#[no_mangle]
2706pub extern "C" fn xmlCharEncOutput(_output: *mut _xmlOutputBuffer, _to: c_int) -> c_int {
2707 // Phase 1: STUB
2708 0
2709}
2710
2711// ═══════════════════════════════════════════════════════════════════════════════
2712// 14. XPath
2713// ═══════════════════════════════════════════════════════════════════════════════
2714
2715/// Create a new XPath context.
2716///
2717/// # UPSTREAM-PARITY
2718///
2719/// ```c
2720/// xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr doc);
2721/// ```
2722#[no_mangle]
2723pub unsafe extern "C" fn xmlXPathNewContext(_doc: *mut _xmlDoc) -> *mut _xmlXPathContext {
2724 // Phase 1: STUB
2725 ptr::null_mut()
2726}
2727
2728/// Free an XPath context.
2729///
2730/// # UPSTREAM-PARITY
2731///
2732/// ```c
2733/// void xmlXPathFreeContext(xmlXPathContextPtr ctxt);
2734/// ```
2735#[no_mangle]
2736pub extern "C" fn xmlXPathFreeContext(_ctxt: *mut _xmlXPathContext) {
2737 // Phase 1: STUB
2738}
2739
2740/// Evaluate an XPath expression.
2741///
2742/// # UPSTREAM-PARITY
2743///
2744/// ```c
2745/// xmlXPathObjectPtr xmlXPathEvalExpression(const xmlChar *str,
2746/// xmlXPathContextPtr ctxt);
2747/// ```
2748#[no_mangle]
2749pub unsafe extern "C" fn xmlXPathEvalExpression(
2750 _str: *const xmlChar,
2751 _ctxt: *mut _xmlXPathContext,
2752) -> *mut _xmlXPathObject {
2753 // Phase 1: STUB
2754 ptr::null_mut()
2755}
2756
2757/// Evaluate an XPath expression (simplified).
2758///
2759/// # UPSTREAM-PARITY
2760///
2761/// ```c
2762/// xmlXPathObjectPtr xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctxt);
2763/// ```
2764#[no_mangle]
2765pub unsafe extern "C" fn xmlXPathEval(
2766 _str: *const xmlChar,
2767 _ctxt: *mut _xmlXPathContext,
2768) -> *mut _xmlXPathObject {
2769 // Phase 1: STUB
2770 ptr::null_mut()
2771}
2772
2773/// Free an XPath object.
2774///
2775/// # UPSTREAM-PARITY
2776///
2777/// ```c
2778/// void xmlXPathFreeObject(xmlXPathObjectPtr obj);
2779/// ```
2780#[no_mangle]
2781pub extern "C" fn xmlXPathFreeObject(_obj: *mut _xmlXPathObject) {
2782 // Phase 1: STUB
2783}
2784
2785/// Compile an XPath expression.
2786///
2787/// # UPSTREAM-PARITY
2788///
2789/// ```c
2790/// xmlXPathCompExprPtr xmlXPathCompile(const xmlChar *str);
2791/// ```
2792#[no_mangle]
2793pub unsafe extern "C" fn xmlXPathCompile(_str: *const xmlChar) -> *mut c_void {
2794 // Phase 1: STUB
2795 ptr::null_mut()
2796}
2797
2798/// Free a compiled XPath expression.
2799///
2800/// # UPSTREAM-PARITY
2801///
2802/// ```c
2803/// void xmlXPathFreeCompExpr(xmlXPathCompExprPtr comp);
2804/// ```
2805#[no_mangle]
2806pub extern "C" fn xmlXPathFreeCompExpr(_comp: *mut c_void) {
2807 // Phase 1: STUB
2808}
2809
2810/// Register an XPath namespace.
2811///
2812/// # UPSTREAM-PARITY
2813///
2814/// ```c
2815/// int xmlXPathRegisterNs(xmlXPathContextPtr ctxt,
2816/// const xmlChar *prefix, const xmlChar *ns_uri);
2817/// ```
2818#[no_mangle]
2819pub unsafe extern "C" fn xmlXPathRegisterNs(
2820 _ctxt: *mut _xmlXPathContext,
2821 _prefix: *const xmlChar,
2822 _ns_uri: *const xmlChar,
2823) -> c_int {
2824 // Phase 1: STUB
2825 0
2826}
2827
2828/// Register an XPath function.
2829///
2830/// # UPSTREAM-PARITY
2831///
2832/// ```c
2833/// int xmlXPathRegisterFunc(xmlXPathContextPtr ctxt,
2834/// const xmlChar *name, xmlXPathFunction f);
2835/// ```
2836#[no_mangle]
2837pub unsafe extern "C" fn xmlXPathRegisterFunc(
2838 _ctxt: *mut _xmlXPathContext,
2839 _name: *const xmlChar,
2840 _f: Option<unsafe extern "C" fn(*mut c_void, c_int)>,
2841) -> c_int {
2842 // Phase 1: STUB
2843 0
2844}
2845
2846/// Register an XPath function with namespace.
2847///
2848/// # UPSTREAM-PARITY
2849///
2850/// ```c
2851/// int xmlXPathRegisterFuncNS(xmlXPathContextPtr ctxt,
2852/// const xmlChar *name, const xmlChar *ns_uri,
2853/// xmlXPathFunction f);
2854/// ```
2855#[no_mangle]
2856pub unsafe extern "C" fn xmlXPathRegisterFuncNS(
2857 _ctxt: *mut _xmlXPathContext,
2858 _name: *const xmlChar,
2859 _ns_uri: *const xmlChar,
2860 _f: Option<unsafe extern "C" fn(*mut c_void, c_int)>,
2861) -> c_int {
2862 // Phase 1: STUB
2863 0
2864}
2865
2866/// Register an XPath variable.
2867///
2868/// # UPSTREAM-PARITY
2869///
2870/// ```c
2871/// int xmlXPathRegisterVariable(xmlXPathContextPtr ctxt,
2872/// const xmlChar *name, xmlXPathObjectPtr value);
2873/// ```
2874#[no_mangle]
2875pub unsafe extern "C" fn xmlXPathRegisterVariable(
2876 _ctxt: *mut _xmlXPathContext,
2877 _name: *const xmlChar,
2878 _value: *mut _xmlXPathObject,
2879) -> c_int {
2880 // Phase 1: STUB
2881 0
2882}
2883
2884/// Create an XPath object from a node set.
2885///
2886/// # UPSTREAM-PARITY
2887///
2888/// ```c
2889/// xmlXPathObjectPtr xmlXPathNewNodeSet(xmlNodePtr val);
2890/// ```
2891#[no_mangle]
2892pub unsafe extern "C" fn xmlXPathNewNodeSet(_val: *mut _xmlNode) -> *mut _xmlXPathObject {
2893 // Phase 1: STUB
2894 ptr::null_mut()
2895}
2896
2897/// Create an XPath object from a value.
2898///
2899/// # UPSTREAM-PARITY
2900///
2901/// ```c
2902/// xmlXPathObjectPtr xmlXPathNewCString(const xmlChar *val);
2903/// ```
2904#[no_mangle]
2905pub unsafe extern "C" fn xmlXPathNewCString(_val: *const xmlChar) -> *mut _xmlXPathObject {
2906 // Phase 1: STUB
2907 ptr::null_mut()
2908}
2909
2910/// Create an XPath number object.
2911///
2912/// # UPSTREAM-PARITY
2913///
2914/// ```c
2915/// xmlXPathObjectPtr xmlXPathNewFloat(double val);
2916/// ```
2917#[no_mangle]
2918pub extern "C" fn xmlXPathNewFloat(_val: f64) -> *mut _xmlXPathObject {
2919 // Phase 1: STUB
2920 ptr::null_mut()
2921}
2922
2923/// Create an XPath boolean object.
2924///
2925/// # UPSTREAM-PARITY
2926///
2927/// ```c
2928/// xmlXPathObjectPtr xmlXPathNewBoolean(int val);
2929/// ```
2930#[no_mangle]
2931pub extern "C" fn xmlXPathNewBoolean(_val: c_int) -> *mut _xmlXPathObject {
2932 // Phase 1: STUB
2933 ptr::null_mut()
2934}
2935
2936// ═══════════════════════════════════════════════════════════════════════════════
2937// 15. XInclude
2938// ═══════════════════════════════════════════════════════════════════════════════
2939
2940/// Process XInclude nodes in a document.
2941///
2942/// # UPSTREAM-PARITY
2943///
2944/// ```c
2945/// int xmlXIncludeProcess(xmlDocPtr doc);
2946/// ```
2947#[no_mangle]
2948pub extern "C" fn xmlXIncludeProcess(_doc: *mut _xmlDoc) -> c_int {
2949 // Phase 1: STUB
2950 -1
2951}
2952
2953/// Process XInclude nodes with flags.
2954///
2955/// # UPSTREAM-PARITY
2956///
2957/// ```c
2958/// int xmlXIncludeProcessFlags(xmlDocPtr doc, int flags);
2959/// ```
2960#[no_mangle]
2961pub extern "C" fn xmlXIncludeProcessFlags(_doc: *mut _xmlDoc, _flags: c_int) -> c_int {
2962 // Phase 1: STUB
2963 -1
2964}
2965
2966// ═══════════════════════════════════════════════════════════════════════════════
2967// 16. Catalog
2968// ═══════════════════════════════════════════════════════════════════════════════
2969
2970/// Load a catalog.
2971///
2972/// # UPSTREAM-PARITY
2973///
2974/// ```c
2975/// xmlCatalogPtr xmlCatalogLoad(const char *catalogs);
2976/// ```
2977#[no_mangle]
2978pub extern "C" fn xmlCatalogLoad(_catalogs: *const c_char) -> *mut c_void {
2979 // Phase 1: STUB
2980 ptr::null_mut()
2981}
2982
2983/// Resolve a public ID.
2984///
2985/// # UPSTREAM-PARITY
2986///
2987/// ```c
2988/// xmlCharPtr xmlCatalogResolvePublic(const xmlChar *pubID);
2989/// ```
2990#[no_mangle]
2991pub unsafe extern "C" fn xmlCatalogResolvePublic(_pubID: *const xmlChar) -> *mut xmlChar {
2992 // Phase 1: STUB
2993 ptr::null_mut()
2994}
2995
2996/// Resolve a system ID.
2997///
2998/// # UPSTREAM-PARITY
2999///
3000/// ```c
3001/// xmlCharPtr xmlCatalogResolveSystem(const xmlChar *sysID);
3002/// ```
3003#[no_mangle]
3004pub unsafe extern "C" fn xmlCatalogResolveSystem(_sysID: *const xmlChar) -> *mut xmlChar {
3005 // Phase 1: STUB
3006 ptr::null_mut()
3007}
3008
3009/// Resolve a URI.
3010///
3011/// # UPSTREAM-PARITY
3012///
3013/// ```c
3014/// xmlCharPtr xmlCatalogResolveURI(const xmlChar *URI);
3015/// ```
3016#[no_mangle]
3017pub unsafe extern "C" fn xmlCatalogResolveURI(_URI: *const xmlChar) -> *mut xmlChar {
3018 // Phase 1: STUB
3019 ptr::null_mut()
3020}
3021
3022/// Set catalog defaults.
3023///
3024/// # UPSTREAM-PARITY
3025///
3026/// ```c
3027/// void xmlCatalogSetDefaults(xmlCatalogAllowValue allow);
3028/// ```
3029#[no_mangle]
3030pub extern "C" fn xmlCatalogSetDefaults(_allow: c_int) {
3031 // Phase 1: STUB
3032}
3033
3034/// Get catalog defaults.
3035///
3036/// # UPSTREAM-PARITY
3037///
3038/// ```c
3039/// xmlCatalogAllowValue xmlCatalogGetDefaults(void);
3040/// ```
3041#[no_mangle]
3042pub extern "C" fn xmlCatalogGetDefaults() -> c_int {
3043 // Phase 1: STUB
3044 0
3045}
3046
3047/// Add a catalog.
3048///
3049/// # UPSTREAM-PARITY
3050///
3051/// ```c
3052/// int xmlCatalogAdd(const xmlChar *type, const xmlChar *orig, const xmlChar *replace);
3053/// ```
3054#[no_mangle]
3055pub unsafe extern "C" fn xmlCatalogAdd(
3056 _type: *const xmlChar,
3057 _orig: *const xmlChar,
3058 _replace: *const xmlChar,
3059) -> c_int {
3060 // Phase 1: STUB
3061 0
3062}
3063
3064/// Remove a catalog entry.
3065///
3066/// # UPSTREAM-PARITY
3067///
3068/// ```c
3069/// int xmlCatalogRemove(const xmlChar *value);
3070/// ```
3071#[no_mangle]
3072pub unsafe extern "C" fn xmlCatalogRemove(_value: *const xmlChar) -> c_int {
3073 // Phase 1: STUB
3074 0
3075}
3076
3077/// Clean up the catalog subsystem.
3078///
3079/// # UPSTREAM-PARITY
3080///
3081/// ```c
3082/// void xmlCatalogCleanup(void);
3083/// ```
3084#[no_mangle]
3085pub extern "C" fn xmlCatalogCleanup() {
3086 // Phase 1: STUB
3087}
3088
3089/// Convert an SGML catalog to XML.
3090///
3091/// # UPSTREAM-PARITY
3092///
3093/// ```c
3094/// xmlDocPtr xmlCatalogConvert(void);
3095/// ```
3096#[no_mangle]
3097pub extern "C" fn xmlCatalogConvert() -> *mut _xmlDoc {
3098 // Phase 1: STUB
3099 ptr::null_mut()
3100}
3101
3102// ═══════════════════════════════════════════════════════════════════════════════
3103// 17. HTML
3104// ═══════════════════════════════════════════════════════════════════════════════
3105
3106/// Parse an HTML document from a file.
3107///
3108/// # UPSTREAM-PARITY
3109///
3110/// ```c
3111/// htmlDocPtr htmlParseFile(const char *filename, const char *encoding);
3112/// ```
3113#[no_mangle]
3114pub unsafe extern "C" fn htmlParseFile(
3115 _filename: *const c_char,
3116 _encoding: *const c_char,
3117) -> *mut _xmlDoc {
3118 // Phase 1: STUB
3119 ptr::null_mut()
3120}
3121
3122/// Parse an HTML document from memory.
3123///
3124/// # UPSTREAM-PARITY
3125///
3126/// ```c
3127/// htmlDocPtr htmlParseMemory(const char *buffer, int size);
3128/// ```
3129#[no_mangle]
3130pub unsafe extern "C" fn htmlParseMemory(_buffer: *const c_char, _size: c_int) -> *mut _xmlDoc {
3131 // Phase 1: STUB
3132 ptr::null_mut()
3133}
3134
3135/// Parse an HTML document from a document string.
3136///
3137/// # UPSTREAM-PARITY
3138///
3139/// ```c
3140/// htmlDocPtr htmlParseDoc(const xmlChar *cur, const char *encoding);
3141/// ```
3142#[no_mangle]
3143pub unsafe extern "C" fn htmlParseDoc(
3144 _cur: *const xmlChar,
3145 _encoding: *const c_char,
3146) -> *mut _xmlDoc {
3147 // Phase 1: STUB
3148 ptr::null_mut()
3149}
3150
3151/// Create an HTML parser context.
3152///
3153/// # UPSTREAM-PARITY
3154///
3155/// ```c
3156/// htmlParserCtxtPtr htmlCreateFileParserCtxt(const char *filename,
3157/// const char *encoding);
3158/// ```
3159#[no_mangle]
3160pub unsafe extern "C" fn htmlCreateFileParserCtxt(
3161 _filename: *const c_char,
3162 _encoding: *const c_char,
3163) -> *mut c_void {
3164 // Phase 1: STUB
3165 ptr::null_mut()
3166}
3167
3168/// Free an HTML parser context.
3169///
3170/// # UPSTREAM-PARITY
3171///
3172/// ```c
3173/// void htmlFreeParserCtxt(htmlParserCtxtPtr ctxt);
3174/// ```
3175#[no_mangle]
3176pub extern "C" fn htmlFreeParserCtxt(_ctxt: *mut c_void) {
3177 // Phase 1: STUB
3178}
3179
3180/// Initialize the HTML parser.
3181///
3182/// # UPSTREAM-PARITY
3183///
3184/// ```c
3185/// void htmlInitParser(void);
3186/// ```
3187#[no_mangle]
3188pub extern "C" fn htmlInitParser() {
3189 // Phase 1: STUB
3190}
3191
3192/// Clean up the HTML parser.
3193///
3194/// # UPSTREAM-PARITY
3195///
3196/// ```c
3197/// void htmlCleanupParser(void);
3198/// ```
3199#[no_mangle]
3200pub extern "C" fn htmlCleanupParser() {
3201 // Phase 1: STUB
3202}
3203
3204// ═══════════════════════════════════════════════════════════════════════════════
3205// 18. Debug / Miscellaneous
3206// ═══════════════════════════════════════════════════════════════════════════════
3207
3208/// Dump a document to a file for debugging.
3209///
3210/// # UPSTREAM-PARITY
3211///
3212/// ```c
3213/// void xmlDebugDumpDocument(FILE *output, xmlDocPtr doc);
3214/// ```
3215#[no_mangle]
3216pub unsafe extern "C" fn xmlDebugDumpDocument(_output: *mut c_void, _doc: *mut _xmlDoc) {
3217 // Phase 1: STUB
3218}
3219
3220/// Dump a node for debugging.
3221///
3222/// # UPSTREAM-PARITY
3223///
3224/// ```c
3225/// void xmlDebugDumpNode(FILE *output, xmlNodePtr node);
3226/// ```
3227#[no_mangle]
3228pub unsafe extern "C" fn xmlDebugDumpNode(_output: *mut c_void, _node: *mut _xmlNode) {
3229 // Phase 1: STUB
3230}
3231
3232/// Dump a node for debugging (recursive).
3233///
3234/// # UPSTREAM-PARITY
3235///
3236/// ```c
3237/// void xmlDebugDumpNodeList(FILE *output, xmlNodePtr node);
3238/// ```
3239#[no_mangle]
3240pub unsafe extern "C" fn xmlDebugDumpNodeList(_output: *mut c_void, _node: *mut _xmlNode) {
3241 // Phase 1: STUB
3242}
3243
3244/// Get the path to the current executable.
3245///
3246/// # UPSTREAM-PARITY
3247///
3248/// ```c
3249/// char *xmlGetBinaryPath(void);
3250/// ```
3251#[no_mangle]
3252pub extern "C" fn xmlGetBinaryPath() -> *mut c_char {
3253 // Phase 1: STUB
3254 ptr::null_mut()
3255}
3256
3257/// Get the path to the current executable's home directory.
3258///
3259/// # UPSTREAM-PARITY
3260///
3261/// ```c
3262/// char *xmlGetHomeOfBinary(void);
3263/// ```
3264#[no_mangle]
3265pub extern "C" fn xmlGetHomeOfBinary() -> *mut c_char {
3266 // Phase 1: STUB
3267 ptr::null_mut()
3268}