1#![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 once_cell::sync::Lazy;
44use parking_lot::Mutex;
45use std::collections::HashMap;
46use std::ffi::CStr;
47use std::mem::size_of;
48use std::os::raw::{c_char, c_int, c_uint};
49
50use crate::xml::xinclude;
51use crate::xml::xpath::ast::CompiledExpr;
52use crate::xml::xpath::context::XPathContext;
53use crate::xml::xpath::types::{NodeSet, XPathValue};
54use crate::xml::xpointer;
55
56use crate::abi::allocator::*;
57use crate::abi::callbacks::*;
58use crate::abi::structs::*;
59use crate::abi::types::*;
60
61#[no_mangle]
76pub unsafe extern "C" fn xmlInitParser() {
77 crate::internal::globals::init_parser();
78}
79
80#[no_mangle]
90pub unsafe extern "C" fn xmlCleanupParser() {
91 crate::internal::globals::cleanup_parser();
92}
93
94#[no_mangle]
104pub unsafe extern "C" fn xmlInitThreads() -> c_int {
105 crate::internal::globals::init_threads()
106}
107
108#[no_mangle]
116pub unsafe extern "C" fn xmlCleanupThreads() {
117 crate::xml::threads::cleanup_threads();
118}
119
120#[no_mangle]
128pub extern "C" fn xmlIsInitialized() -> c_int {
129 if crate::abi::versioning::is_initialized() {
130 1
131 } else {
132 0
133 }
134}
135
136#[no_mangle]
145pub unsafe extern "C" fn xmlLockLibrary() {
146 crate::xml::threads::lock_library();
147}
148
149#[no_mangle]
157pub unsafe extern "C" fn xmlUnlockLibrary() {
158 crate::xml::threads::unlock_library();
159}
160
161#[no_mangle]
178pub unsafe extern "C" fn xmlSetGenericErrorFunc(
179 ctx: *mut c_void,
180 handler: Option<xmlGenericErrorFunc>,
181) {
182 unsafe { crate::xml::errors::set_generic_error_func(ctx, handler) };
184}
185
186#[no_mangle]
198pub unsafe extern "C" fn xmlSetStructuredErrorFunc(
199 ctx: *mut c_void,
200 handler: Option<xmlStructuredErrorFunc>,
201) {
202 unsafe { crate::xml::errors::set_structured_error_func(ctx, handler) };
204}
205
206#[no_mangle]
217pub extern "C" fn xmlGetLastError() -> *mut _xmlError {
218 crate::xml::errors::get_last_error()
219}
220
221#[no_mangle]
235pub unsafe extern "C" fn xmlCopyError(from: *const _xmlError, to: *mut _xmlError) -> c_int {
236 unsafe { crate::xml::errors::copy_error(from, to) }
238}
239
240#[no_mangle]
252pub unsafe extern "C" fn xmlResetError(err: *mut _xmlError) {
253 unsafe { crate::xml::errors::reset_error(err) };
255}
256
257#[no_mangle]
270pub unsafe extern "C" fn xmlRaiseError(
271 ctxt: *mut c_void,
272 ctxt2: *mut c_void,
273 ctxt3: *mut c_void,
274 ctxt4: *mut c_void,
275 ctxt5: *mut c_void,
276 domain: c_int,
277 code: c_int,
278 level: c_int,
279 file: *const c_char,
280 line: c_int,
281 str1: *const c_char,
282 str2: *const c_char,
283 str3: *const c_char,
284 int1: c_int,
285 int2: c_int,
286 msg: *const c_char,
287) {
288 unsafe {
290 crate::xml::errors::raise_error(
291 ctxt, ctxt2, ctxt3, ctxt4, ctxt5, domain, code, level, file, line, str1, str2, str3,
292 int1, int2, msg,
293 );
294 }
295}
296
297#[no_mangle]
305pub extern "C" fn xmlResetLastError() {
306 crate::xml::errors::reset_last_error();
307}
308
309#[no_mangle]
325pub unsafe extern "C" fn xmlStrdup(cur: *const xmlChar) -> *mut xmlChar {
326 if cur.is_null() {
327 return ptr::null_mut();
328 }
329 let len = unsafe { xmlStrlen(cur) };
330 let size = len + 1;
331 let new_ptr = unsafe { xmlMalloc(size as usize) };
332 if new_ptr.is_null() {
333 return ptr::null_mut();
334 }
335 unsafe {
336 ptr::copy_nonoverlapping(cur as *const u8, new_ptr as *mut u8, size as usize);
337 }
338 new_ptr as *mut xmlChar
339}
340
341#[no_mangle]
353pub unsafe extern "C" fn xmlStrndup(cur: *const xmlChar, len: c_int) -> *mut xmlChar {
354 if cur.is_null() || len <= 0 {
355 return ptr::null_mut();
356 }
357 let size = len as usize + 1;
358 let new_ptr = unsafe { xmlMalloc(size) };
359 if new_ptr.is_null() {
360 return ptr::null_mut();
361 }
362 unsafe {
363 ptr::copy_nonoverlapping(cur as *const u8, new_ptr as *mut u8, len as usize);
364 *(new_ptr.add(len as usize) as *mut u8) = 0;
365 }
366 new_ptr as *mut xmlChar
367}
368
369#[no_mangle]
381pub unsafe extern "C" fn xmlStrlen(str: *const xmlChar) -> c_int {
382 if str.is_null() {
383 return 0;
384 }
385 unsafe { libc::strlen(str as *const c_char) as c_int }
386}
387
388#[no_mangle]
399pub unsafe extern "C" fn xmlStrcmp(str1: *const xmlChar, str2: *const xmlChar) -> c_int {
400 if str1.is_null() && str2.is_null() {
401 return 0;
402 }
403 if str1.is_null() {
404 return -1;
405 }
406 if str2.is_null() {
407 return 1;
408 }
409 unsafe { libc::strcmp(str1 as *const c_char, str2 as *const c_char) as c_int }
410}
411
412#[no_mangle]
420pub unsafe extern "C" fn xmlStrncmp(
421 str1: *const xmlChar,
422 str2: *const xmlChar,
423 len: c_int,
424) -> c_int {
425 if len <= 0 {
426 return 0;
427 }
428 if str1.is_null() && str2.is_null() {
429 return 0;
430 }
431 if str1.is_null() {
432 return -1;
433 }
434 if str2.is_null() {
435 return 1;
436 }
437 unsafe { libc::strncmp(str1 as *const c_char, str2 as *const c_char, len as usize) as c_int }
438}
439
440#[no_mangle]
448pub unsafe extern "C" fn xmlStrcasecmp(str1: *const xmlChar, str2: *const xmlChar) -> c_int {
449 if str1.is_null() && str2.is_null() {
450 return 0;
451 }
452 if str1.is_null() {
453 return -1;
454 }
455 if str2.is_null() {
456 return 1;
457 }
458 unsafe { libc::strcasecmp(str1 as *const c_char, str2 as *const c_char) as c_int }
459}
460
461#[no_mangle]
469pub unsafe extern "C" fn xmlStrncasecmp(
470 str1: *const xmlChar,
471 str2: *const xmlChar,
472 len: c_int,
473) -> c_int {
474 if len <= 0 {
475 return 0;
476 }
477 if str1.is_null() && str2.is_null() {
478 return 0;
479 }
480 if str1.is_null() {
481 return -1;
482 }
483 if str2.is_null() {
484 return 1;
485 }
486 unsafe {
487 libc::strncasecmp(str1 as *const c_char, str2 as *const c_char, len as usize) as c_int
488 }
489}
490
491#[no_mangle]
501pub unsafe extern "C" fn xmlStrEqual(str1: *const xmlChar, str2: *const xmlChar) -> c_int {
502 if str1.is_null() && str2.is_null() {
503 return 1;
504 }
505 if str1.is_null() || str2.is_null() {
506 return 0;
507 }
508 unsafe { (libc::strcmp(str1 as *const c_char, str2 as *const c_char) == 0) as c_int }
509}
510
511#[no_mangle]
522pub unsafe extern "C" fn xmlStrQEqual(
523 pref: *const xmlChar,
524 name: *const xmlChar,
525 str: *const xmlChar,
526) -> c_int {
527 if name.is_null() || str.is_null() {
528 return 0;
529 }
530 if pref.is_null() {
531 return unsafe { xmlStrEqual(name, str) };
532 }
533 let pref_len = unsafe { xmlStrlen(pref) };
535 let name_len = unsafe { xmlStrlen(name) };
536 let total_len = pref_len + 1 + name_len;
537 let str_len = unsafe { xmlStrlen(str) };
538 if total_len != str_len {
539 return 0;
540 }
541 if unsafe {
543 libc::strncmp(
544 pref as *const c_char,
545 str as *const c_char,
546 pref_len as usize,
547 )
548 } != 0
549 {
550 return 0;
551 }
552 if unsafe { *str.add(pref_len as usize) } != b':' as xmlChar {
554 return 0;
555 }
556 (unsafe {
558 libc::strncmp(
559 name as *const c_char,
560 str.add((pref_len + 1) as usize) as *const c_char,
561 name_len as usize,
562 ) == 0
563 }) as c_int
564}
565
566#[no_mangle]
580pub unsafe extern "C" fn xmlStrcat(cur: *mut xmlChar, add: *const xmlChar) -> *mut xmlChar {
581 if add.is_null() {
582 return cur;
583 }
584 if cur.is_null() {
585 return unsafe { xmlStrdup(add) };
586 }
587 let cur_len = unsafe { xmlStrlen(cur) } as usize;
588 let add_len = unsafe { xmlStrlen(add) } as usize;
589 let new_size = cur_len + add_len + 1;
590 let new_ptr = unsafe { xmlRealloc(cur as *mut c_void, new_size) };
591 if new_ptr.is_null() {
592 return ptr::null_mut();
593 }
594 unsafe {
595 ptr::copy_nonoverlapping(add as *const u8, (new_ptr as *mut u8).add(cur_len), add_len);
596 *((new_ptr as *mut u8).add(cur_len + add_len)) = 0;
597 }
598 new_ptr as *mut xmlChar
599}
600
601#[no_mangle]
613pub unsafe extern "C" fn xmlStrncat(
614 cur: *mut xmlChar,
615 add: *const xmlChar,
616 len: c_int,
617) -> *mut xmlChar {
618 if add.is_null() || len <= 0 {
619 return cur;
620 }
621 let len = len as usize;
622 if cur.is_null() {
623 return unsafe { xmlStrndup(add, len as c_int) };
624 }
625 let cur_len = unsafe { xmlStrlen(cur) } as usize;
626 let new_size = cur_len + len + 1;
627 let new_ptr = unsafe { xmlRealloc(cur as *mut c_void, new_size) };
628 if new_ptr.is_null() {
629 return ptr::null_mut();
630 }
631 unsafe {
632 ptr::copy_nonoverlapping(add as *const u8, (new_ptr as *mut u8).add(cur_len), len);
633 *((new_ptr as *mut u8).add(cur_len + len)) = 0;
634 }
635 new_ptr as *mut xmlChar
636}
637
638#[no_mangle]
646pub unsafe extern "C" fn xmlStrncatNew(
647 str1: *const xmlChar,
648 str2: *const xmlChar,
649 len: c_int,
650) -> *mut xmlChar {
651 let mut result: *mut xmlChar = ptr::null_mut();
652 if !str1.is_null() {
653 result = unsafe { xmlStrdup(str1) };
654 }
655 if !str2.is_null() && len > 0 {
656 result = unsafe { xmlStrncat(result, str2, len) };
657 }
658 result
659}
660
661#[no_mangle]
674pub unsafe extern "C" fn xmlStrcpy(dst: *mut xmlChar, src: *const xmlChar) -> *mut xmlChar {
675 if dst.is_null() || src.is_null() {
676 return dst;
677 }
678 let len = unsafe { xmlStrlen(src) } as usize + 1;
679 unsafe {
680 ptr::copy_nonoverlapping(src as *const u8, dst as *mut u8, len);
681 }
682 dst
683}
684
685#[no_mangle]
693pub unsafe extern "C" fn xmlStrncpy(
694 dst: *mut xmlChar,
695 src: *const xmlChar,
696 len: c_int,
697) -> *mut xmlChar {
698 if dst.is_null() || src.is_null() || len <= 0 {
699 return dst;
700 }
701 let len = len as usize;
702 let src_len = unsafe { xmlStrlen(src) } as usize;
703 let copy_len = if src_len < len { src_len } else { len - 1 };
704 unsafe {
705 ptr::copy_nonoverlapping(src as *const u8, dst as *mut u8, copy_len);
706 *dst.add(copy_len) = 0;
707 }
708 dst
709}
710
711#[no_mangle]
721pub unsafe extern "C" fn xmlStrsub(str: *const xmlChar, start: c_int, len: c_int) -> *mut xmlChar {
722 if str.is_null() || start < 0 || len < 0 {
723 return ptr::null_mut();
724 }
725 let str_len = unsafe { xmlStrlen(str) };
726 if start >= str_len {
727 return unsafe { xmlStrdup(b"\0" as *const u8 as *const xmlChar) };
728 }
729 let actual_len = if start + len > str_len {
730 str_len - start
731 } else {
732 len
733 };
734 unsafe { xmlStrndup(str.add(start as usize), actual_len) }
735}
736
737#[no_mangle]
754pub unsafe extern "C" fn xmlNewDoc(version: *const xmlChar) -> *mut _xmlDoc {
755 crate::xml::tree::new_doc(version)
756}
757
758#[no_mangle]
770pub unsafe extern "C" fn xmlFreeDoc(doc: *mut _xmlDoc) {
771 crate::xml::tree::free_doc(doc);
772}
773
774#[no_mangle]
788pub unsafe extern "C" fn xmlNewNode(ns: *mut _xmlNs, name: *const xmlChar) -> *mut _xmlNode {
789 crate::xml::tree::new_node(ns, name)
790}
791
792#[no_mangle]
805pub unsafe extern "C" fn xmlFreeNode(node: *mut _xmlNode) {
806 crate::xml::tree::free_node(node);
807}
808
809#[no_mangle]
821pub unsafe extern "C" fn xmlUnlinkNode(node: *mut _xmlNode) {
822 crate::xml::tree::unlink_node(node);
823}
824
825#[no_mangle]
839pub unsafe extern "C" fn xmlAddChild(parent: *mut _xmlNode, cur: *mut _xmlNode) -> *mut _xmlNode {
840 crate::xml::tree::add_child(parent, cur)
841}
842
843#[no_mangle]
855pub unsafe extern "C" fn xmlAddSibling(
856 cur: *mut _xmlNode,
857 sibling: *mut _xmlNode,
858) -> *mut _xmlNode {
859 crate::xml::tree::add_sibling(cur, sibling)
860}
861
862#[no_mangle]
881pub unsafe extern "C" fn xmlNewChild(
882 parent: *mut _xmlNode,
883 ns: *mut _xmlNs,
884 name: *const xmlChar,
885 content: *const xmlChar,
886) -> *mut _xmlNode {
887 crate::xml::tree::new_child(parent, ns, name)
888}
889
890#[no_mangle]
905pub unsafe extern "C" fn xmlDocSetRootElement(
906 doc: *mut _xmlDoc,
907 root: *mut _xmlNode,
908) -> *mut _xmlNode {
909 crate::xml::tree::doc_set_root_element(doc, root)
910}
911
912#[no_mangle]
922pub extern "C" fn xmlDocGetRootElement(doc: *const _xmlDoc) -> *mut _xmlNode {
923 crate::xml::tree::doc_get_root_element(doc as *mut _xmlDoc)
924}
925
926#[no_mangle]
939pub unsafe extern "C" fn xmlCopyNode(node: *const _xmlNode, extended: c_int) -> *mut _xmlNode {
940 crate::xml::tree::copy_node(node, extended)
941}
942
943#[no_mangle]
953pub unsafe extern "C" fn xmlCopyDoc(doc: *const _xmlDoc, recursive: c_int) -> *mut _xmlDoc {
954 crate::xml::tree::copy_doc(doc, recursive)
955}
956
957#[no_mangle]
968pub unsafe extern "C" fn xmlNewText(content: *const xmlChar) -> *mut _xmlNode {
969 crate::xml::tree::new_text(content)
970}
971
972#[no_mangle]
980pub unsafe extern "C" fn xmlNewComment(content: *const xmlChar) -> *mut _xmlNode {
981 crate::xml::tree::new_comment(content)
982}
983
984#[no_mangle]
992pub unsafe extern "C" fn xmlNewPI(name: *const xmlChar, content: *const xmlChar) -> *mut _xmlNode {
993 crate::xml::tree::new_pi(name, content)
994}
995
996#[no_mangle]
1004pub unsafe extern "C" fn xmlNewCDataBlock(
1005 doc: *mut _xmlDoc,
1006 content: *const xmlChar,
1007 len: c_int,
1008) -> *mut _xmlNode {
1009 crate::xml::tree::new_cdata_block(doc, content, len)
1010}
1011
1012#[no_mangle]
1026pub unsafe extern "C" fn xmlNewNs(
1027 node: *mut _xmlNode,
1028 href: *const xmlChar,
1029 prefix: *const xmlChar,
1030) -> *mut _xmlNs {
1031 crate::xml::tree::new_ns(node, href, prefix)
1032}
1033
1034#[no_mangle]
1042pub unsafe extern "C" fn xmlSetNs(node: *mut _xmlNode, ns: *mut _xmlNs) {
1043 crate::xml::tree::set_ns(node, ns);
1044}
1045
1046#[no_mangle]
1054pub unsafe extern "C" fn xmlGetNsList(
1055 doc: *mut _xmlDoc,
1056 node: *const _xmlNode,
1057) -> *mut *mut _xmlNs {
1058 crate::xml::tree::get_ns_list(doc, node as *mut _xmlNode)
1059}
1060
1061#[no_mangle]
1069pub unsafe extern "C" fn xmlSearchNs(
1070 doc: *mut _xmlDoc,
1071 node: *mut _xmlNode,
1072 nameSpace: *const xmlChar,
1073) -> *mut _xmlNs {
1074 crate::xml::tree::search_ns(doc, node, nameSpace)
1075}
1076
1077#[no_mangle]
1085pub unsafe extern "C" fn xmlSearchNsByHref(
1086 doc: *mut _xmlDoc,
1087 node: *mut _xmlNode,
1088 href: *const xmlChar,
1089) -> *mut _xmlNs {
1090 crate::xml::tree::search_ns_by_href(doc, node, href)
1091}
1092
1093#[no_mangle]
1110pub unsafe extern "C" fn xmlSetProp(
1111 node: *mut _xmlNode,
1112 name: *const xmlChar,
1113 value: *const xmlChar,
1114) -> *mut _xmlAttr {
1115 crate::xml::tree::set_prop(node, name, value)
1116}
1117
1118#[no_mangle]
1128pub unsafe extern "C" fn xmlGetProp(node: *const _xmlNode, name: *const xmlChar) -> *mut xmlChar {
1129 crate::xml::tree::get_prop(node as *mut _xmlNode, name)
1130}
1131
1132#[no_mangle]
1140pub unsafe extern "C" fn xmlGetNsProp(
1141 node: *const _xmlNode,
1142 name: *const xmlChar,
1143 nameSpace: *const xmlChar,
1144) -> *mut xmlChar {
1145 crate::xml::tree::get_ns_prop(node as *mut _xmlNode, name, nameSpace)
1146}
1147
1148#[no_mangle]
1157pub unsafe extern "C" fn xmlSetNsProp(
1158 node: *mut _xmlNode,
1159 ns: *mut _xmlNs,
1160 name: *const xmlChar,
1161 value: *const xmlChar,
1162) -> *mut _xmlAttr {
1163 crate::xml::tree::set_ns_prop(node, ns, name, value)
1164}
1165
1166#[no_mangle]
1176pub unsafe extern "C" fn xmlRemoveProp(attr: *mut _xmlAttr) -> c_int {
1177 crate::xml::tree::remove_prop(attr)
1178}
1179
1180#[no_mangle]
1188pub extern "C" fn xmlGetIntSubset(doc: *const _xmlDoc) -> *mut _xmlDtd {
1189 crate::xml::tree::get_int_subset(doc)
1190}
1191
1192#[no_mangle]
1201pub unsafe extern "C" fn xmlNewDtd(
1202 doc: *mut _xmlDoc,
1203 name: *const xmlChar,
1204 ExternalID: *const xmlChar,
1205 SystemID: *const xmlChar,
1206) -> *mut _xmlDtd {
1207 crate::xml::tree::new_dtd(doc, name, ExternalID, SystemID)
1208}
1209
1210#[no_mangle]
1220pub unsafe extern "C" fn xmlNewEntity(
1221 doc: *mut _xmlDoc,
1222 name: *const xmlChar,
1223 type_: c_int,
1224 ExternalID: *const xmlChar,
1225 SystemID: *const xmlChar,
1226 content: *const xmlChar,
1227) -> *mut _xmlEntity {
1228 crate::xml::tree::new_entity(doc, name, type_, ExternalID, SystemID, content)
1229}
1230
1231#[no_mangle]
1239pub unsafe extern "C" fn xmlGetDocEntity(
1240 doc: *const _xmlDoc,
1241 name: *const xmlChar,
1242) -> *mut _xmlEntity {
1243 crate::xml::tree::get_doc_entity(doc, name)
1244}
1245
1246#[no_mangle]
1254pub unsafe extern "C" fn xmlGetParameterEntity(
1255 doc: *const _xmlDoc,
1256 name: *const xmlChar,
1257) -> *mut _xmlEntity {
1258 crate::xml::tree::get_parameter_entity(doc, name)
1259}
1260
1261#[no_mangle]
1272pub unsafe extern "C" fn xmlCreateIntSubset(
1273 doc: *mut _xmlDoc,
1274 name: *const xmlChar,
1275 ExternalID: *const xmlChar,
1276 SystemID: *const xmlChar,
1277) -> *mut _xmlDtd {
1278 crate::xml::dtd::create_int_subset(doc, name, ExternalID, SystemID)
1279}
1280
1281#[no_mangle]
1289pub unsafe extern "C" fn xmlFreeDtd(dtd: *mut _xmlDtd) {
1290 crate::xml::dtd::free_dtd(dtd);
1291}
1292
1293#[no_mangle]
1303pub unsafe extern "C" fn xmlAddNotationDecl(
1304 dtd: *mut _xmlDtd,
1305 name: *const xmlChar,
1306 PublicID: *const xmlChar,
1307 SystemID: *const xmlChar,
1308) -> *mut _xmlNotation {
1309 crate::xml::dtd::add_notation_decl(dtd, name, PublicID, SystemID)
1310}
1311
1312#[no_mangle]
1320pub unsafe extern "C" fn xmlGetNotationDecl(
1321 dtd: *mut _xmlDtd,
1322 name: *const xmlChar,
1323) -> *mut _xmlNotation {
1324 crate::xml::dtd::get_notation_decl(dtd, name)
1325}
1326
1327#[no_mangle]
1335pub unsafe extern "C" fn xmlCopyNotation(notation: *mut _xmlNotation) -> *mut _xmlNotation {
1336 crate::xml::dtd::copy_notation(notation)
1337}
1338
1339#[no_mangle]
1347pub unsafe extern "C" fn xmlFreeNotation(notation: *mut _xmlNotation) {
1348 crate::xml::dtd::free_notation(notation);
1349}
1350
1351#[no_mangle]
1360pub unsafe extern "C" fn xmlAddElementDecl(
1361 dtd: *mut _xmlDtd,
1362 name: *const xmlChar,
1363 type_: c_int,
1364 content: *mut _xmlElementContent,
1365) -> *mut _xmlElement {
1366 crate::xml::dtd::add_element_decl(dtd, name, type_, content)
1367}
1368
1369#[no_mangle]
1377pub unsafe extern "C" fn xmlGetElementDecl(
1378 dtd: *mut _xmlDtd,
1379 name: *const xmlChar,
1380) -> *mut _xmlElement {
1381 crate::xml::dtd::get_element_decl(dtd, name)
1382}
1383
1384#[no_mangle]
1392pub unsafe extern "C" fn xmlCopyElement(elem: *mut _xmlElement) -> *mut _xmlElement {
1393 crate::xml::dtd::copy_element(elem)
1394}
1395
1396#[no_mangle]
1404pub unsafe extern "C" fn xmlFreeElement(elem: *mut _xmlElement) {
1405 crate::xml::dtd::free_element(elem);
1406}
1407
1408#[no_mangle]
1419pub unsafe extern "C" fn xmlAddAttributeDecl(
1420 dtd: *mut _xmlDtd,
1421 elem: *mut _xmlElement,
1422 name: *const xmlChar,
1423 type_: c_int,
1424 def: c_int,
1425 defaultValue: *const xmlChar,
1426 tree: *mut _xmlEnumeration,
1427) -> *mut _xmlAttribute {
1428 crate::xml::dtd::add_attribute_decl(dtd, elem, name, type_, def, defaultValue, tree)
1429}
1430
1431#[no_mangle]
1440pub unsafe extern "C" fn xmlGetAttributeDecl(
1441 dtd: *mut _xmlDtd,
1442 elem: *mut _xmlElement,
1443 name: *const xmlChar,
1444 namePrefix: c_int,
1445) -> *mut _xmlAttribute {
1446 crate::xml::dtd::get_attribute_decl(dtd, elem, name, namePrefix)
1447}
1448
1449#[no_mangle]
1457pub unsafe extern "C" fn xmlCopyAttribute(attr: *mut _xmlAttribute) -> *mut _xmlAttribute {
1458 crate::xml::dtd::copy_attribute_decl(attr)
1459}
1460
1461#[no_mangle]
1469pub unsafe extern "C" fn xmlFreeAttribute(attr: *mut _xmlAttribute) {
1470 crate::xml::dtd::free_attribute(attr);
1471}
1472
1473#[no_mangle]
1481pub unsafe extern "C" fn xmlNewElementContent(
1482 name: *const xmlChar,
1483 type_: c_int,
1484) -> *mut _xmlElementContent {
1485 crate::xml::dtd::create_content_model(name, type_)
1486}
1487
1488#[no_mangle]
1496pub unsafe extern "C" fn xmlCopyElementContent(
1497 content: *mut _xmlElementContent,
1498) -> *mut _xmlElementContent {
1499 crate::xml::dtd::copy_content_model(content)
1500}
1501
1502#[no_mangle]
1510pub unsafe extern "C" fn xmlFreeElementContent(cur: *mut _xmlElementContent) {
1511 crate::xml::dtd::free_content_model(cur);
1512}
1513
1514#[no_mangle]
1526pub unsafe extern "C" fn xmlAddEntity(
1527 dtd: *mut _xmlDtd,
1528 name: *const xmlChar,
1529 type_: c_int,
1530 ExternalID: *const xmlChar,
1531 SystemID: *const xmlChar,
1532 content: *const xmlChar,
1533) -> *mut _xmlEntity {
1534 crate::xml::entities::add_entity(dtd, name, type_, ExternalID, SystemID, content)
1535}
1536
1537#[no_mangle]
1545pub unsafe extern "C" fn xmlGetEntity(doc: *mut _xmlDoc, name: *const xmlChar) -> *mut _xmlEntity {
1546 crate::xml::entities::get_entity(doc, name)
1547}
1548
1549#[no_mangle]
1557pub unsafe extern "C" fn xmlCopyEntity(entity: *mut _xmlEntity) -> *mut _xmlEntity {
1558 crate::xml::entities::copy_entity(entity)
1559}
1560
1561#[no_mangle]
1569pub unsafe extern "C" fn xmlFreeEntity(entity: *mut _xmlEntity) {
1570 crate::xml::entities::free_entity(entity);
1571}
1572
1573#[no_mangle]
1581pub unsafe extern "C" fn xmlEncodeEntitiesReentrant(
1582 doc: *mut _xmlDoc,
1583 input: *const xmlChar,
1584) -> *mut xmlChar {
1585 crate::xml::entities::encode_entities_reentrant(doc, input)
1586}
1587
1588#[no_mangle]
1596pub extern "C" fn xmlGetLineNo(node: *const _xmlNode) -> c_int {
1597 crate::xml::tree::get_line_no(node)
1598}
1599
1600#[no_mangle]
1612pub unsafe extern "C" fn xmlNodeDump(
1613 buf: *mut _xmlBuffer,
1614 doc: *mut _xmlDoc,
1615 cur: *mut _xmlNode,
1616 level: c_int,
1617 format: c_int,
1618) -> c_int {
1619 if buf.is_null() || cur.is_null() {
1620 return -1;
1621 }
1622 crate::xml::tree::xmlNodeDump(buf, doc, cur, level, format)
1623}
1624
1625#[no_mangle]
1633pub unsafe extern "C" fn xmlDocDump(fp: *mut c_void, doc: *mut _xmlDoc) -> c_int {
1634 if fp.is_null() || doc.is_null() {
1635 return -1;
1636 }
1637 crate::xml::tree::xmlDocDump(fp, doc)
1638}
1639
1640#[no_mangle]
1648pub unsafe extern "C" fn xmlDocDumpFormatMemory(
1649 doc: *mut _xmlDoc,
1650 mem: *mut *mut xmlChar,
1651 size: *mut c_int,
1652 format: c_int,
1653) {
1654 if doc.is_null() || mem.is_null() || size.is_null() {
1655 return;
1656 }
1657 crate::xml::tree::xmlDocDumpFormatMemory(doc, mem, size, format)
1658}
1659
1660#[no_mangle]
1668pub unsafe extern "C" fn xmlDocDumpMemory(
1669 doc: *mut _xmlDoc,
1670 mem: *mut *mut xmlChar,
1671 size: *mut c_int,
1672) {
1673 if doc.is_null() || mem.is_null() || size.is_null() {
1674 return;
1675 }
1676 crate::xml::tree::xmlDocDumpMemory(doc, mem, size)
1677}
1678
1679#[no_mangle]
1687pub unsafe extern "C" fn xmlSaveFile(filename: *const c_char, cur: *mut _xmlDoc) -> c_int {
1688 if filename.is_null() || cur.is_null() {
1689 return -1;
1690 }
1691 crate::xml::tree::xmlSaveFile(filename, cur)
1692}
1693
1694#[no_mangle]
1702pub unsafe extern "C" fn xmlSaveFileEnc(
1703 filename: *const c_char,
1704 cur: *mut _xmlDoc,
1705 encoding: *const c_char,
1706) -> c_int {
1707 if filename.is_null() || cur.is_null() {
1708 return -1;
1709 }
1710 crate::xml::tree::xmlSaveFileEnc(filename, cur, encoding)
1711}
1712
1713#[no_mangle]
1721pub unsafe extern "C" fn xmlSaveFormatFile(
1722 filename: *const c_char,
1723 cur: *mut _xmlDoc,
1724 format: c_int,
1725) -> c_int {
1726 if filename.is_null() || cur.is_null() {
1727 return -1;
1728 }
1729 crate::xml::tree::xmlSaveFormatFile(filename, cur, format)
1730}
1731
1732#[no_mangle]
1740pub unsafe extern "C" fn xmlSaveFormatFileEnc(
1741 filename: *const c_char,
1742 cur: *mut _xmlDoc,
1743 encoding: *const c_char,
1744 format: c_int,
1745) -> c_int {
1746 if filename.is_null() || cur.is_null() {
1747 return -1;
1748 }
1749 crate::xml::tree::xmlSaveFormatFileEnc(filename, cur, encoding, format)
1750}
1751
1752#[no_mangle]
1767pub unsafe extern "C" fn xmlReadDoc(
1768 cur: *const xmlChar,
1769 URL: *const c_char,
1770 encoding: *const c_char,
1771 options: c_int,
1772) -> *mut _xmlDoc {
1773 if cur.is_null() {
1775 return ptr::null_mut();
1776 }
1777 let ctxt = crate::xml::parser::helpers::create_parser_ctxt();
1778 if ctxt.is_null() {
1779 return ptr::null_mut();
1780 }
1781 let len = crate::xml::string::xml_strlen(cur);
1782 let input = crate::xml::parser::helpers::input_from_memory(cur as *const c_char, len as c_int);
1783 crate::xml::parser::helpers::setup_parser_input(ctxt, input);
1784 (*ctxt).options = options;
1785 if crate::xml::parser::helpers::parse_document(ctxt) != 0 {
1786 let doc = (*ctxt).myDoc;
1787 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
1788 return doc;
1789 }
1790 let doc = (*ctxt).myDoc;
1791 if !doc.is_null() {
1792 (*doc).URL = crate::xml::string::xml_strdup(URL as *const xmlChar);
1793 }
1794 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
1795 doc
1796}
1797
1798#[no_mangle]
1806pub unsafe extern "C" fn xmlReadFile(
1807 URL: *const c_char,
1808 encoding: *const c_char,
1809 options: c_int,
1810) -> *mut _xmlDoc {
1811 if URL.is_null() {
1813 return ptr::null_mut();
1814 }
1815 let ctxt = crate::xml::parser::helpers::create_parser_ctxt();
1816 if ctxt.is_null() {
1817 return ptr::null_mut();
1818 }
1819 let input = match crate::xml::parser::helpers::input_from_file(URL) {
1820 Ok(input) => input,
1821 Err(_) => {
1822 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
1823 return ptr::null_mut();
1824 }
1825 };
1826 crate::xml::parser::helpers::setup_parser_input(ctxt, input);
1827 (*ctxt).options = options;
1828 if crate::xml::parser::helpers::parse_document(ctxt) != 0 {
1829 let doc = (*ctxt).myDoc;
1830 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
1831 return doc;
1832 }
1833 let doc = (*ctxt).myDoc;
1834 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
1835 doc
1836}
1837
1838#[no_mangle]
1847pub unsafe extern "C" fn xmlReadMemory(
1848 buffer: *const c_char,
1849 size: c_int,
1850 URL: *const c_char,
1851 encoding: *const c_char,
1852 options: c_int,
1853) -> *mut _xmlDoc {
1854 if buffer.is_null() || size <= 0 {
1856 return ptr::null_mut();
1857 }
1858 let ctxt = crate::xml::parser::helpers::create_parser_ctxt();
1859 if ctxt.is_null() {
1860 return ptr::null_mut();
1861 }
1862 let input = crate::xml::parser::helpers::input_from_memory(buffer, size);
1863 crate::xml::parser::helpers::setup_parser_input(ctxt, input);
1864 (*ctxt).options = options;
1865 if crate::xml::parser::helpers::parse_document(ctxt) != 0 {
1866 let doc = (*ctxt).myDoc;
1867 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
1868 return doc;
1869 }
1870 let doc = (*ctxt).myDoc;
1871 if !doc.is_null() && !URL.is_null() {
1872 (*doc).URL = crate::xml::string::xml_strdup(URL as *const xmlChar);
1873 }
1874 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
1875 doc
1876}
1877
1878#[no_mangle]
1886pub unsafe extern "C" fn xmlReadFd(
1887 fd: c_int,
1888 URL: *const c_char,
1889 encoding: *const c_char,
1890 options: c_int,
1891) -> *mut _xmlDoc {
1892 let ctxt = crate::xml::parser::helpers::create_parser_ctxt();
1894 if ctxt.is_null() {
1895 return ptr::null_mut();
1896 }
1897 let mut buf = Vec::new();
1899 let mut tmp = [0u8; 4096];
1900 loop {
1901 let n = libc::read(fd, tmp.as_mut_ptr() as *mut c_void, tmp.len());
1902 if n <= 0 {
1903 break;
1904 }
1905 buf.extend_from_slice(&tmp[..n as usize]);
1906 }
1907 let input = crate::xml::parser::helpers::input_from_memory(
1908 buf.as_ptr() as *const c_char,
1909 buf.len() as c_int,
1910 );
1911 crate::xml::parser::helpers::setup_parser_input(ctxt, input);
1912 (*ctxt).options = options;
1913 if crate::xml::parser::helpers::parse_document(ctxt) != 0 {
1914 let doc = (*ctxt).myDoc;
1915 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
1916 return doc;
1917 }
1918 let doc = (*ctxt).myDoc;
1919 if !doc.is_null() && !URL.is_null() {
1920 (*doc).URL = crate::xml::string::xml_strdup(URL as *const xmlChar);
1921 }
1922 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
1923 doc
1924}
1925
1926#[no_mangle]
1935pub unsafe extern "C" fn xmlReadIO(
1936 ioread: Option<xmlInputReadCallback>,
1937 ioclose: Option<xmlInputCloseCallback>,
1938 ioctx: *mut c_void,
1939 URL: *const c_char,
1940 encoding: *const c_char,
1941 options: c_int,
1942) -> *mut _xmlDoc {
1943 let ctxt = crate::xml::parser::helpers::create_parser_ctxt();
1945 if ctxt.is_null() {
1946 return ptr::null_mut();
1947 }
1948 let input = crate::xml::parser::helpers::input_from_io(ioread, ioclose, ioctx);
1949 crate::xml::parser::helpers::setup_parser_input(ctxt, input);
1950 (*ctxt).options = options;
1951 if crate::xml::parser::helpers::parse_document(ctxt) != 0 {
1952 let doc = (*ctxt).myDoc;
1953 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
1954 return doc;
1955 }
1956 let doc = (*ctxt).myDoc;
1957 if !doc.is_null() && !URL.is_null() {
1958 (*doc).URL = crate::xml::string::xml_strdup(URL as *const xmlChar);
1959 }
1960 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
1961 doc
1962}
1963
1964#[no_mangle]
1972pub unsafe extern "C" fn xmlSAXParseDoc(
1973 sax: *mut _xmlSAXHandler,
1974 cur: *const xmlChar,
1975 recovery: c_int,
1976) -> *mut _xmlDoc {
1977 if cur.is_null() {
1979 return ptr::null_mut();
1980 }
1981 let ctxt = crate::xml::parser::helpers::create_parser_ctxt();
1982 if ctxt.is_null() {
1983 return ptr::null_mut();
1984 }
1985 if !sax.is_null() {
1986 (*ctxt).sax = sax;
1987 (*ctxt).userData = (*ctxt).sax as *mut c_void;
1988 }
1989 if recovery != 0 {
1990 (*ctxt).recovery = 1;
1991 (*ctxt).options |= 1; }
1993 let len = crate::xml::string::xml_strlen(cur);
1994 let input = crate::xml::parser::helpers::input_from_memory(cur as *const c_char, len as c_int);
1995 crate::xml::parser::helpers::setup_parser_input(ctxt, input);
1996 crate::xml::parser::helpers::parse_document(ctxt);
1997 let doc = (*ctxt).myDoc;
1998 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
1999 doc
2000}
2001
2002#[no_mangle]
2010pub unsafe extern "C" fn xmlSAXParseFile(
2011 sax: *mut _xmlSAXHandler,
2012 filename: *const c_char,
2013 recovery: c_int,
2014) -> *mut _xmlDoc {
2015 if filename.is_null() {
2017 return ptr::null_mut();
2018 }
2019 let ctxt = crate::xml::parser::helpers::create_parser_ctxt();
2020 if ctxt.is_null() {
2021 return ptr::null_mut();
2022 }
2023 if !sax.is_null() {
2024 (*ctxt).sax = sax;
2025 (*ctxt).userData = (*ctxt).sax as *mut c_void;
2026 }
2027 if recovery != 0 {
2028 (*ctxt).recovery = 1;
2029 (*ctxt).options |= 1;
2030 }
2031 let input = match crate::xml::parser::helpers::input_from_file(filename) {
2032 Ok(input) => input,
2033 Err(_) => {
2034 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
2035 return ptr::null_mut();
2036 }
2037 };
2038 crate::xml::parser::helpers::setup_parser_input(ctxt, input);
2039 crate::xml::parser::helpers::parse_document(ctxt);
2040 let doc = (*ctxt).myDoc;
2041 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
2042 doc
2043}
2044
2045#[no_mangle]
2054pub unsafe extern "C" fn xmlSAXParseMemory(
2055 sax: *mut _xmlSAXHandler,
2056 buffer: *const c_char,
2057 size: c_int,
2058 recovery: c_int,
2059) -> *mut _xmlDoc {
2060 if buffer.is_null() || size <= 0 {
2062 return ptr::null_mut();
2063 }
2064 let ctxt = crate::xml::parser::helpers::create_parser_ctxt();
2065 if ctxt.is_null() {
2066 return ptr::null_mut();
2067 }
2068 if !sax.is_null() {
2069 (*ctxt).sax = sax;
2070 (*ctxt).userData = (*ctxt).sax as *mut c_void;
2071 }
2072 if recovery != 0 {
2073 (*ctxt).recovery = 1;
2074 (*ctxt).options |= 1;
2075 }
2076 let input = crate::xml::parser::helpers::input_from_memory(buffer, size);
2077 crate::xml::parser::helpers::setup_parser_input(ctxt, input);
2078 crate::xml::parser::helpers::parse_document(ctxt);
2079 let doc = (*ctxt).myDoc;
2080 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
2081 doc
2082}
2083
2084#[no_mangle]
2093pub unsafe extern "C" fn xmlSAXUserParseFile(
2094 sax: *mut _xmlSAXHandler,
2095 user_data: *mut c_void,
2096 filename: *const c_char,
2097) -> c_int {
2098 if filename.is_null() {
2100 return -1;
2101 }
2102 let ctxt = crate::xml::parser::helpers::create_parser_ctxt();
2103 if ctxt.is_null() {
2104 return -1;
2105 }
2106 if !sax.is_null() {
2107 (*ctxt).sax = sax;
2108 }
2109 (*ctxt).userData = if !user_data.is_null() {
2110 user_data
2111 } else {
2112 ctxt as *mut c_void
2113 };
2114 let input = match crate::xml::parser::helpers::input_from_file(filename) {
2115 Ok(input) => input,
2116 Err(_) => {
2117 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
2118 return -1;
2119 }
2120 };
2121 crate::xml::parser::helpers::setup_parser_input(ctxt, input);
2122 let ret = crate::xml::parser::helpers::parse_document(ctxt);
2123 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
2124 ret
2125}
2126
2127#[no_mangle]
2136pub unsafe extern "C" fn xmlSAXUserParseMemory(
2137 sax: *mut _xmlSAXHandler,
2138 user_data: *mut c_void,
2139 buffer: *const c_char,
2140 size: c_int,
2141) -> c_int {
2142 if buffer.is_null() || size <= 0 {
2144 return -1;
2145 }
2146 let ctxt = crate::xml::parser::helpers::create_parser_ctxt();
2147 if ctxt.is_null() {
2148 return -1;
2149 }
2150 if !sax.is_null() {
2151 (*ctxt).sax = sax;
2152 }
2153 (*ctxt).userData = if !user_data.is_null() {
2154 user_data
2155 } else {
2156 ctxt as *mut c_void
2157 };
2158 let input = crate::xml::parser::helpers::input_from_memory(buffer, size);
2159 crate::xml::parser::helpers::setup_parser_input(ctxt, input);
2160 let ret = crate::xml::parser::helpers::parse_document(ctxt);
2161 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
2162 ret
2163}
2164
2165#[no_mangle]
2173pub unsafe extern "C" fn xmlParseDoc(cur: *const xmlChar) -> *mut _xmlDoc {
2174 if cur.is_null() {
2176 return ptr::null_mut();
2177 }
2178 xmlReadDoc(cur, ptr::null(), ptr::null(), 0)
2179}
2180
2181#[no_mangle]
2189pub unsafe extern "C" fn xmlParseFile(filename: *const c_char) -> *mut _xmlDoc {
2190 if filename.is_null() {
2192 return ptr::null_mut();
2193 }
2194 xmlReadFile(filename, ptr::null(), 0)
2195}
2196
2197#[no_mangle]
2205pub unsafe extern "C" fn xmlParseMemory(buffer: *const c_char, size: c_int) -> *mut _xmlDoc {
2206 if buffer.is_null() || size <= 0 {
2208 return ptr::null_mut();
2209 }
2210 xmlReadMemory(buffer, size, ptr::null(), ptr::null(), 0)
2211}
2212
2213#[no_mangle]
2221pub unsafe extern "C" fn xmlCreateFileParserCtxt(filename: *const c_char) -> *mut _xmlParserCtxt {
2222 if filename.is_null() {
2224 return ptr::null_mut();
2225 }
2226 let ctxt = crate::xml::parser::helpers::create_parser_ctxt();
2227 if ctxt.is_null() {
2228 return ptr::null_mut();
2229 }
2230 let input = match crate::xml::parser::helpers::input_from_file(filename) {
2231 Ok(input) => input,
2232 Err(_) => {
2233 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
2234 return ptr::null_mut();
2235 }
2236 };
2237 crate::xml::parser::helpers::setup_parser_input(ctxt, input);
2238 ctxt
2239}
2240
2241#[no_mangle]
2249pub unsafe extern "C" fn xmlCreateDocParserCtxt(cur: *const xmlChar) -> *mut _xmlParserCtxt {
2250 if cur.is_null() {
2252 return ptr::null_mut();
2253 }
2254 let ctxt = crate::xml::parser::helpers::create_parser_ctxt();
2255 if ctxt.is_null() {
2256 return ptr::null_mut();
2257 }
2258 let len = crate::xml::string::xml_strlen(cur);
2259 let input = crate::xml::parser::helpers::input_from_memory(cur as *const c_char, len as c_int);
2260 crate::xml::parser::helpers::setup_parser_input(ctxt, input);
2261 ctxt
2262}
2263
2264#[no_mangle]
2272pub unsafe extern "C" fn xmlParseDocument(ctxt: *mut _xmlParserCtxt) -> c_int {
2273 if ctxt.is_null() {
2275 return -1;
2276 }
2277 crate::xml::parser::helpers::parse_document(ctxt)
2278}
2279
2280#[no_mangle]
2288pub unsafe extern "C" fn xmlFreeParserCtxt(ctxt: *mut _xmlParserCtxt) {
2289 if ctxt.is_null() {
2290 return;
2291 }
2292 crate::xml::parser::helpers::free_parser_ctxt(ctxt);
2293}
2294
2295#[no_mangle]
2303pub unsafe extern "C" fn xmlCtxtUseOptions(ctxt: *mut _xmlParserCtxt, options: c_int) -> c_int {
2304 if ctxt.is_null() {
2305 return -1;
2306 }
2307 unsafe {
2309 (*ctxt).options = options;
2310 }
2311 0
2312}
2313
2314#[no_mangle]
2323pub unsafe extern "C" fn xmlParseChunk(
2324 ctxt: *mut _xmlParserCtxt,
2325 chunk: *const c_char,
2326 size: c_int,
2327 terminate: c_int,
2328) -> c_int {
2329 if ctxt.is_null() {
2332 return -1;
2333 }
2334 crate::xml::parser::helpers::parse_chunk(ctxt, chunk, size, terminate)
2335}
2336
2337#[no_mangle]
2345pub unsafe extern "C" fn xmlParserInputBufferCreateMem(
2346 buffer: *const c_char,
2347 size: c_int,
2348 enc: c_int,
2349) -> *mut _xmlParserInputBuffer {
2350 if buffer.is_null() || size <= 0 {
2352 return ptr::null_mut();
2353 }
2354 crate::xml::parser::helpers::alloc_parser_input_buffer()
2355}
2356
2357#[no_mangle]
2365pub unsafe extern "C" fn xmlParserInputBufferCreateFilename(
2366 URI: *const c_char,
2367 enc: c_int,
2368) -> *mut _xmlParserInputBuffer {
2369 if URI.is_null() {
2371 return ptr::null_mut();
2372 }
2373 crate::xml::parser::helpers::alloc_parser_input_buffer()
2374}
2375
2376#[no_mangle]
2386pub unsafe extern "C" fn xmlParserInputBufferCreateIO(
2387 ioread: Option<xmlInputReadCallback>,
2388 ioclose: Option<xmlInputCloseCallback>,
2389 ioctx: *mut c_void,
2390 enc: c_int,
2391) -> *mut _xmlParserInputBuffer {
2392 let buf = crate::xml::parser::helpers::alloc_parser_input_buffer();
2394 if !buf.is_null() {
2395 (*buf).readcallback = ioread;
2396 (*buf).closecallback = ioclose;
2397 (*buf).context = ioctx;
2398 }
2399 buf
2400}
2401
2402#[no_mangle]
2410pub unsafe extern "C" fn xmlFreeParserInputBuffer(buf: *mut _xmlParserInputBuffer) {
2411 if buf.is_null() {
2412 return;
2413 }
2414 crate::xml::parser::helpers::free_parser_input_buffer(buf);
2415}
2416
2417#[no_mangle]
2425pub unsafe extern "C" fn xmlNewInputFromFile(
2426 ctxt: *mut _xmlParserCtxt,
2427 filename: *const c_char,
2428) -> *mut _xmlParserInput {
2429 if filename.is_null() {
2434 return ptr::null_mut();
2435 }
2436 crate::xml::parser::helpers::alloc_parser_input_buffer() as *mut _xmlParserInput
2437}
2438
2439#[no_mangle]
2447pub unsafe extern "C" fn xmlFreeInputStream(input: *mut _xmlParserInput) {
2448 if input.is_null() {
2449 return;
2450 }
2451 crate::xml::parser::helpers::free_parser_input(input);
2452}
2453
2454#[no_mangle]
2468pub unsafe extern "C" fn xmlOutputBufferCreateFilename(
2469 URI: *const c_char,
2470 encoder: *mut c_void,
2471 compression: c_int,
2472) -> *mut _xmlOutputBuffer {
2473 let _ = compression;
2474 if URI.is_null() {
2475 return ptr::null_mut();
2476 }
2477 crate::xml::io::output_buffer_create_filename(
2478 URI,
2479 encoder as *mut crate::abi::structs::_xmlCharEncodingHandler,
2480 0,
2481 )
2482}
2483
2484#[no_mangle]
2493pub unsafe extern "C" fn xmlOutputBufferCreateFd(
2494 fd: c_int,
2495 encoder: *mut c_void,
2496) -> *mut _xmlOutputBuffer {
2497 if fd < 0 {
2498 return ptr::null_mut();
2499 }
2500 crate::xml::io::output_buffer_create_fd(
2501 fd,
2502 encoder as *mut crate::abi::structs::_xmlCharEncodingHandler,
2503 )
2504}
2505
2506#[no_mangle]
2516pub unsafe extern "C" fn xmlOutputBufferCreateIO(
2517 iowrite: Option<xmlOutputWriteCallback>,
2518 ioclose: Option<xmlOutputCloseCallback>,
2519 ioctx: *mut c_void,
2520 encoder: *mut c_void,
2521) -> *mut _xmlOutputBuffer {
2522 crate::xml::io::output_buffer_create_io(
2523 iowrite,
2524 ioclose,
2525 ioctx,
2526 encoder as *mut crate::abi::structs::_xmlCharEncodingHandler,
2527 )
2528}
2529
2530#[no_mangle]
2538pub unsafe extern "C" fn xmlOutputBufferClose(out: *mut _xmlOutputBuffer) -> c_int {
2539 if out.is_null() {
2540 return -1;
2541 }
2542 crate::xml::io::output_buffer_close(out)
2543}
2544
2545#[no_mangle]
2553pub unsafe extern "C" fn xmlOutputBufferFlush(out: *mut _xmlOutputBuffer) -> c_int {
2554 if out.is_null() {
2555 return -1;
2556 }
2557 crate::xml::io::output_buffer_flush(out)
2558}
2559
2560#[no_mangle]
2568pub unsafe extern "C" fn xmlOutputBufferWrite(
2569 out: *mut _xmlOutputBuffer,
2570 len: c_int,
2571 data: *const c_char,
2572) -> c_int {
2573 if out.is_null() || data.is_null() || len <= 0 {
2574 return -1;
2575 }
2576 crate::xml::io::output_buffer_write(out, len, data)
2577}
2578
2579#[no_mangle]
2587pub unsafe extern "C" fn xmlOutputBufferWriteString(
2588 out: *mut _xmlOutputBuffer,
2589 str: *const c_char,
2590) -> c_int {
2591 if str.is_null() {
2592 return 0;
2593 }
2594 unsafe { xmlOutputBufferWrite(out, xmlStrlen(str as *const xmlChar), str) }
2595}
2596
2597#[no_mangle]
2609pub extern "C" fn xmlDictCreate() -> *mut c_void {
2610 ptr::null_mut()
2612}
2613
2614#[no_mangle]
2622pub extern "C" fn xmlDictCreateSub(_sub: *mut c_void) -> *mut c_void {
2623 ptr::null_mut()
2625}
2626
2627#[no_mangle]
2639pub unsafe extern "C" fn xmlDictLookup(
2640 dict: *mut c_void,
2641 name: *const xmlChar,
2642 len: c_int,
2643) -> *const xmlChar {
2644 name
2646}
2647
2648#[no_mangle]
2656pub unsafe extern "C" fn xmlDictExists(
2657 dict: *mut c_void,
2658 name: *const xmlChar,
2659 len: c_int,
2660) -> *const xmlChar {
2661 ptr::null()
2663}
2664
2665#[no_mangle]
2673pub extern "C" fn xmlDictSize(dict: *const c_void) -> c_uint {
2674 0
2676}
2677
2678#[no_mangle]
2686pub extern "C" fn xmlDictFree(_dict: *mut c_void) {
2687 }
2689
2690#[no_mangle]
2698pub extern "C" fn xmlDictSetLimit(_dict: *mut c_void, _limit: c_uint) -> c_uint {
2699 0
2701}
2702
2703#[no_mangle]
2711pub extern "C" fn xmlDictGetUsage(_dict: *const c_void) -> c_uint {
2712 0
2714}
2715
2716#[no_mangle]
2728pub extern "C" fn xmlHashCreate(_size: c_int) -> *mut c_void {
2729 ptr::null_mut()
2731}
2732
2733#[no_mangle]
2741pub extern "C" fn xmlHashCreateDict(_size: c_int, _dict: *mut c_void) -> *mut c_void {
2742 ptr::null_mut()
2744}
2745
2746#[no_mangle]
2754pub extern "C" fn xmlHashFree(
2755 _table: *mut c_void,
2756 _f: Option<unsafe extern "C" fn(*mut c_void, *mut xmlChar)>,
2757) {
2758 }
2760
2761#[no_mangle]
2769pub unsafe extern "C" fn xmlHashAddEntry(
2770 _table: *mut c_void,
2771 _name: *const xmlChar,
2772 _userdata: *mut c_void,
2773) -> c_int {
2774 0
2776}
2777
2778#[no_mangle]
2787pub unsafe extern "C" fn xmlHashAddEntry2(
2788 _table: *mut c_void,
2789 _name: *const xmlChar,
2790 _name2: *const xmlChar,
2791 _userdata: *mut c_void,
2792) -> c_int {
2793 0
2795}
2796
2797#[no_mangle]
2806pub unsafe extern "C" fn xmlHashAddEntry3(
2807 _table: *mut c_void,
2808 _name: *const xmlChar,
2809 _name2: *const xmlChar,
2810 _name3: *const xmlChar,
2811 _userdata: *mut c_void,
2812) -> c_int {
2813 0
2815}
2816
2817#[no_mangle]
2826pub unsafe extern "C" fn xmlHashUpdateEntry(
2827 _table: *mut c_void,
2828 _name: *const xmlChar,
2829 _userdata: *mut c_void,
2830 _f: Option<unsafe extern "C" fn(*mut c_void, *mut xmlChar)>,
2831) -> c_int {
2832 0
2834}
2835
2836#[no_mangle]
2838pub unsafe extern "C" fn xmlHashUpdateEntry2(
2839 _table: *mut c_void,
2840 _name: *const xmlChar,
2841 _name2: *const xmlChar,
2842 _userdata: *mut c_void,
2843 _f: Option<unsafe extern "C" fn(*mut c_void, *mut xmlChar)>,
2844) -> c_int {
2845 0
2847}
2848
2849#[no_mangle]
2851pub unsafe extern "C" fn xmlHashUpdateEntry3(
2852 _table: *mut c_void,
2853 _name: *const xmlChar,
2854 _name2: *const xmlChar,
2855 _name3: *const xmlChar,
2856 _userdata: *mut c_void,
2857 _f: Option<unsafe extern "C" fn(*mut c_void, *mut xmlChar)>,
2858) -> c_int {
2859 0
2861}
2862
2863#[no_mangle]
2871pub unsafe extern "C" fn xmlHashLookup(_table: *mut c_void, _name: *const xmlChar) -> *mut c_void {
2872 ptr::null_mut()
2874}
2875
2876#[no_mangle]
2878pub unsafe extern "C" fn xmlHashLookup2(
2879 _table: *mut c_void,
2880 _name: *const xmlChar,
2881 _name2: *const xmlChar,
2882) -> *mut c_void {
2883 ptr::null_mut()
2885}
2886
2887#[no_mangle]
2889pub unsafe extern "C" fn xmlHashLookup3(
2890 _table: *mut c_void,
2891 _name: *const xmlChar,
2892 _name2: *const xmlChar,
2893 _name3: *const xmlChar,
2894) -> *mut c_void {
2895 ptr::null_mut()
2897}
2898
2899#[no_mangle]
2907pub extern "C" fn xmlHashSize(_table: *mut c_void) -> c_int {
2908 0
2910}
2911
2912#[no_mangle]
2921pub unsafe extern "C" fn xmlHashRemoveEntry(
2922 _table: *mut c_void,
2923 _name: *const xmlChar,
2924 _f: Option<unsafe extern "C" fn(*mut c_void, *mut xmlChar)>,
2925) -> c_int {
2926 0
2928}
2929
2930#[no_mangle]
2932pub unsafe extern "C" fn xmlHashRemoveEntry2(
2933 _table: *mut c_void,
2934 _name: *const xmlChar,
2935 _name2: *const xmlChar,
2936 _f: Option<unsafe extern "C" fn(*mut c_void, *mut xmlChar)>,
2937) -> c_int {
2938 0
2940}
2941
2942#[no_mangle]
2944pub unsafe extern "C" fn xmlHashRemoveEntry3(
2945 _table: *mut c_void,
2946 _name: *const xmlChar,
2947 _name2: *const xmlChar,
2948 _name3: *const xmlChar,
2949 _f: Option<unsafe extern "C" fn(*mut c_void, *mut xmlChar)>,
2950) -> c_int {
2951 0
2953}
2954
2955#[no_mangle]
2963pub extern "C" fn xmlHashScan(
2964 _table: *mut c_void,
2965 _f: Option<unsafe extern "C" fn(*mut c_void, *const xmlChar, *mut c_void)>,
2966 _data: *mut c_void,
2967) {
2968 }
2970
2971#[no_mangle]
2973pub extern "C" fn xmlHashScanFull(
2974 _table: *mut c_void,
2975 _f: Option<unsafe extern "C" fn(*mut c_void, *const xmlChar, *mut c_void, *mut c_void)>,
2976 _data: *mut c_void,
2977) {
2978 }
2980
2981#[no_mangle]
2989pub extern "C" fn xmlHashCopy(
2990 _table: *mut c_void,
2991 _f: Option<unsafe extern "C" fn(*mut c_void, *const xmlChar) -> *mut c_void>,
2992) -> *mut c_void {
2993 ptr::null_mut()
2995}
2996
2997#[no_mangle]
3010pub extern "C" fn xmlListCreate(
3011 _deallocator: Option<unsafe extern "C" fn(*mut c_void)>,
3012 _compare: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
3013) -> *mut c_void {
3014 ptr::null_mut()
3016}
3017
3018#[no_mangle]
3026pub extern "C" fn xmlListDelete(_list: *mut c_void) {
3027 }
3029
3030#[no_mangle]
3038pub extern "C" fn xmlListSearch(_list: *mut c_void, _data: *mut c_void) -> *mut c_void {
3039 ptr::null_mut()
3041}
3042
3043#[no_mangle]
3051pub extern "C" fn xmlListWalk(
3052 _list: *mut c_void,
3053 _walker: Option<unsafe extern "C" fn(*mut c_void, *mut c_void) -> c_int>,
3054 _data: *mut c_void,
3055) {
3056 }
3058
3059#[no_mangle]
3067pub extern "C" fn xmlListPushBack(_list: *mut c_void, _data: *mut c_void) -> c_int {
3068 0
3070}
3071
3072#[no_mangle]
3080pub extern "C" fn xmlListPushFront(_list: *mut c_void, _data: *mut c_void) -> c_int {
3081 0
3083}
3084
3085#[no_mangle]
3087pub extern "C" fn xmlListPopBack(_list: *mut c_void) {
3088 }
3090
3091#[no_mangle]
3093pub extern "C" fn xmlListPopFront(_list: *mut c_void) {
3094 }
3096
3097#[no_mangle]
3105pub extern "C" fn xmlListInsert(_list: *mut c_void, _data: *mut c_void) -> c_int {
3106 0
3108}
3109
3110#[no_mangle]
3112pub extern "C" fn xmlListAppend(_list: *mut c_void, _data: *mut c_void) -> c_int {
3113 0
3115}
3116
3117#[no_mangle]
3119pub extern "C" fn xmlListRemoveFirst(_list: *mut c_void, _data: *mut c_void) -> c_int {
3120 0
3122}
3123
3124#[no_mangle]
3126pub extern "C" fn xmlListRemoveLast(_list: *mut c_void, _data: *mut c_void) -> c_int {
3127 0
3129}
3130
3131#[no_mangle]
3133pub extern "C" fn xmlListRemoveAll(_list: *mut c_void, _data: *mut c_void) -> c_int {
3134 0
3136}
3137
3138#[no_mangle]
3140pub extern "C" fn xmlListClear(_list: *mut c_void) {
3141 }
3143
3144#[no_mangle]
3152pub extern "C" fn xmlListEmpty(_list: *mut c_void) -> c_int {
3153 1
3155}
3156
3157#[no_mangle]
3165pub extern "C" fn xmlListFront(_list: *mut c_void) -> *mut c_void {
3166 ptr::null_mut()
3168}
3169
3170#[no_mangle]
3178pub extern "C" fn xmlListBack(_list: *mut c_void) -> *mut c_void {
3179 ptr::null_mut()
3181}
3182
3183#[no_mangle]
3191pub extern "C" fn xmlListSize(_list: *mut c_void) -> c_int {
3192 0
3194}
3195
3196#[no_mangle]
3198pub extern "C" fn xmlListSort(_list: *mut c_void) {
3199 }
3201
3202#[no_mangle]
3204pub extern "C" fn xmlListReverse(_list: *mut c_void) {
3205 }
3207
3208#[no_mangle]
3210pub extern "C" fn xmlListReverseSplice(_list: *mut c_void, _list2: *mut c_void) {
3211 }
3213
3214#[no_mangle]
3216pub extern "C" fn xmlListMerge(_list: *mut c_void, _list2: *mut c_void) {
3217 }
3219
3220#[no_mangle]
3232pub extern "C" fn xmlBufferCreate() -> *mut _xmlBuffer {
3233 crate::xml::io::buf_create(-1)
3234}
3235
3236#[no_mangle]
3244pub extern "C" fn xmlBufferCreateSize(size: usize) -> *mut _xmlBuffer {
3245 crate::xml::io::buf_create(size as c_int)
3246}
3247
3248#[no_mangle]
3256pub extern "C" fn xmlBufferCreateStatic(mem: *mut c_void, size: usize) -> *mut _xmlBuffer {
3257 if mem.is_null() || size == 0 {
3258 return ptr::null_mut();
3259 }
3260 crate::xml::io::buf_create_static(mem as *const xmlChar, size as c_int)
3261}
3262
3263#[no_mangle]
3271pub extern "C" fn xmlBufferFree(buf: *mut _xmlBuffer) {
3272 crate::xml::io::buf_free(buf)
3273}
3274
3275#[no_mangle]
3283pub extern "C" fn xmlBufferEmpty(buf: *mut _xmlBuffer) {
3284 if buf.is_null() {
3285 return;
3286 }
3287 unsafe {
3288 if !(*buf).content.is_null() {
3289 *(*buf).content = 0;
3290 }
3291 (*buf).use_ = 0;
3292 }
3293}
3294
3295#[no_mangle]
3303pub extern "C" fn xmlBufferContent(buf: *const _xmlBuffer) -> *mut xmlChar {
3304 crate::xml::io::buf_content(buf as *mut _xmlBuffer)
3305}
3306
3307#[no_mangle]
3315pub extern "C" fn xmlBufferLength(buf: *const _xmlBuffer) -> c_int {
3316 crate::xml::io::buf_length(buf as *mut _xmlBuffer)
3317}
3318
3319#[no_mangle]
3327pub unsafe extern "C" fn xmlBufferAdd(
3328 buf: *mut _xmlBuffer,
3329 str: *const xmlChar,
3330 len: c_int,
3331) -> c_int {
3332 crate::xml::io::buf_add(buf, str, len)
3333}
3334
3335#[no_mangle]
3343pub unsafe extern "C" fn xmlBufferAddHead(
3344 buf: *mut _xmlBuffer,
3345 str: *const xmlChar,
3346 len: c_int,
3347) -> c_int {
3348 crate::xml::io::buf_add_head(buf, str, len)
3349}
3350
3351#[no_mangle]
3359pub unsafe extern "C" fn xmlBufferCat(buf: *mut _xmlBuffer, str: *const xmlChar) -> c_int {
3360 if str.is_null() {
3361 return -1;
3362 }
3363 let len = crate::xml::string::xml_strlen(str) as c_int;
3364 crate::xml::io::buf_add(buf, str, len)
3365}
3366
3367#[no_mangle]
3376pub extern "C" fn xmlBufferSetAllocationScheme(buf: *mut _xmlBuffer, scheme: c_int) {
3377 if buf.is_null() {
3378 return;
3379 }
3380 unsafe {
3381 (*buf).alloc = scheme;
3382 }
3383}
3384
3385#[no_mangle]
3393pub extern "C" fn xmlBufferShrink(buf: *mut _xmlBuffer, len: c_int) -> c_int {
3394 if buf.is_null() || len <= 0 {
3395 return 0;
3396 }
3397 unsafe {
3398 let b = &mut *buf;
3399 let shrink_len = (len as c_uint).min(b.use_);
3400 if shrink_len > 0 {
3401 let remaining = b.use_ - shrink_len;
3402 if remaining > 0 {
3403 core::ptr::copy(
3404 b.content.add(shrink_len as usize),
3405 b.content,
3406 remaining as usize,
3407 );
3408 }
3409 *b.content.add(remaining as usize) = 0;
3410 b.use_ = remaining;
3411 }
3412 }
3413 len
3414}
3415
3416#[no_mangle]
3424pub extern "C" fn xmlBufferGrow(buf: *mut _xmlBuffer, len: c_int) -> c_int {
3425 if buf.is_null() || len <= 0 {
3426 return 0;
3427 }
3428 let cur_use = unsafe { (*buf).use_ };
3429 let new_size = cur_use + len as c_uint + 1;
3430 crate::xml::io::buf_grow(buf, new_size)
3431}
3432
3433#[no_mangle]
3441pub extern "C" fn xmlBufferReserve(buf: *mut _xmlBuffer, len: c_int) -> c_int {
3442 xmlBufferGrow(buf, len)
3443}
3444
3445#[no_mangle]
3453pub extern "C" fn xmlBufferDetach(buf: *mut _xmlBuffer) -> *mut xmlChar {
3454 if buf.is_null() {
3455 return ptr::null_mut();
3456 }
3457 unsafe {
3458 let content = (*buf).content;
3459 (*buf).content = ptr::null_mut();
3460 (*buf).use_ = 0;
3461 (*buf).size = 0;
3462 content
3463 }
3464}
3465
3466#[no_mangle]
3478pub extern "C" fn xmlGetCharEncoding(name: *const c_char) -> c_int {
3479 if name.is_null() {
3480 return 0; }
3482 let name_bytes = unsafe {
3483 let len = libc::strlen(name);
3484 core::slice::from_raw_parts(name as *const u8, len)
3485 };
3486 crate::xml::encoding::encoding_from_name(name_bytes) as c_int
3487}
3488
3489#[no_mangle]
3497pub extern "C" fn xmlFindCharEncodingHandler(name: *const c_char) -> *mut c_void {
3498 if name.is_null() {
3499 return ptr::null_mut();
3500 }
3501 crate::xml::encoding::find_encoding_handler(name as *const xmlChar) as *mut c_void
3502}
3503
3504#[no_mangle]
3512pub extern "C" fn xmlCharEncCloseFunc(handler: *mut c_void) -> c_int {
3513 if handler.is_null() {
3514 return -1;
3515 }
3516 unsafe {
3518 let h = handler as *mut crate::abi::structs::_xmlCharEncodingHandler;
3519 if !(*h).name.is_null() {
3520 crate::abi::allocator::xmlFree((*h).name as *mut c_void);
3521 }
3522 crate::abi::allocator::xmlFree(handler);
3523 }
3524 0
3525}
3526
3527#[no_mangle]
3535pub unsafe extern "C" fn xmlCharEncInput(input: *mut _xmlParserInputBuffer, _to: c_int) -> c_int {
3536 if input.is_null() {
3537 return -1;
3538 }
3539 let handler = (*input).encoder as *mut crate::abi::structs::_xmlCharEncodingHandler;
3540 if handler.is_null() {
3541 return -1;
3542 }
3543 let raw = (*input).raw as *mut crate::abi::structs::_xmlBuffer;
3544 let buf = (*input).buffer as *mut crate::abi::structs::_xmlBuffer;
3545 if raw.is_null() || buf.is_null() {
3546 return -1;
3547 }
3548 crate::xml::encoding::char_enc_in(handler, buf, raw)
3549}
3550
3551#[no_mangle]
3559pub unsafe extern "C" fn xmlCharEncOutput(output: *mut _xmlOutputBuffer, _to: c_int) -> c_int {
3560 if output.is_null() {
3561 return -1;
3562 }
3563 let handler = (*output).encoder as *mut crate::abi::structs::_xmlCharEncodingHandler;
3564 if handler.is_null() {
3565 return -1;
3566 }
3567 let buf = (*output).buffer as *mut crate::abi::structs::_xmlBuffer;
3568 let conv = (*output).conv as *mut crate::abi::structs::_xmlBuffer;
3569 if buf.is_null() || conv.is_null() {
3570 return -1;
3571 }
3572 crate::xml::encoding::char_enc_out(handler, conv, buf)
3573}
3574
3575#[no_mangle]
3587pub unsafe extern "C" fn xmlParseURI(str: *const c_char) -> *mut c_void {
3588 crate::xml::uri::xmlParseURI(str)
3589}
3590
3591#[no_mangle]
3599pub unsafe extern "C" fn xmlParseURIRaw(str: *const c_char, raw: c_int) -> *mut c_void {
3600 let _ = raw;
3601 crate::xml::uri::xmlParseURI(str)
3602}
3603
3604#[no_mangle]
3612pub unsafe extern "C" fn xmlFreeURI(uri: *mut c_void) {
3613 crate::xml::uri::xmlFreeURI(uri)
3614}
3615
3616#[no_mangle]
3624pub extern "C" fn xmlCreateURI() -> *mut c_void {
3625 crate::xml::uri::xmlCreateURI()
3626}
3627
3628#[no_mangle]
3636pub unsafe extern "C" fn xmlSaveUri(uri: *mut c_void) -> *mut xmlChar {
3637 crate::xml::uri::xmlSaveUri(uri)
3638}
3639
3640#[no_mangle]
3648pub unsafe extern "C" fn xmlURIEscapeStr(
3649 str: *const xmlChar,
3650 list: *const xmlChar,
3651) -> *mut xmlChar {
3652 crate::xml::uri::xmlURIEscapeStr(str, list)
3653}
3654
3655#[no_mangle]
3663pub unsafe extern "C" fn xmlURIUnescapeString(
3664 str: *const c_char,
3665 len: c_int,
3666 target: *mut c_char,
3667) -> *mut c_char {
3668 crate::xml::uri::xmlURIUnescapeString(str, len, target)
3669}
3670
3671unsafe fn xpath_to_object(val: XPathValue) -> *mut _xmlXPathObject {
3686 let obj = xmlMallocZero(size_of::<_xmlXPathObject>()) as *mut _xmlXPathObject;
3687 if obj.is_null() {
3688 return ptr::null_mut();
3689 }
3690 match val {
3691 XPathValue::NodeSet(ns) => {
3692 (*obj).type_ = xmlXPathObjectType::XPATH_NODESET as c_int;
3693 (*obj).nodesetval = ns.to_raw() as *mut c_void;
3694 }
3695 XPathValue::Boolean(b) => {
3696 (*obj).type_ = xmlXPathObjectType::XPATH_BOOLEAN as c_int;
3697 (*obj).boolval = if b { 1 } else { 0 };
3698 }
3699 XPathValue::Number(n) => {
3700 (*obj).type_ = xmlXPathObjectType::XPATH_NUMBER as c_int;
3701 (*obj).floatval = n;
3702 }
3703 XPathValue::String(s) => {
3704 (*obj).type_ = xmlXPathObjectType::XPATH_STRING as c_int;
3705 let bytes = s.as_bytes();
3706 let len = bytes.len();
3707 let buf = xmlMalloc(len + 1) as *mut xmlChar;
3708 if !buf.is_null() {
3709 ptr::copy_nonoverlapping(bytes.as_ptr(), buf, len);
3710 *buf.add(len) = 0; }
3712 (*obj).stringval = buf;
3713 }
3714 }
3715 obj
3716}
3717
3718unsafe fn object_to_xpathvalue(obj: *mut _xmlXPathObject) -> XPathValue {
3725 let typ = (*obj).type_;
3726 if typ == xmlXPathObjectType::XPATH_NODESET as c_int {
3727 let ns_ptr = (*obj).nodesetval as *mut _xmlNodeSet;
3728 if ns_ptr.is_null() {
3729 return XPathValue::NodeSet(NodeSet::new());
3730 }
3731 let node_nr = (*ns_ptr).nodeNr;
3732 let node_tab = (*ns_ptr).nodeTab;
3733 let mut ns = NodeSet::new();
3734 if !node_tab.is_null() {
3735 for i in 0..node_nr as isize {
3736 let node = *node_tab.add(i as usize);
3737 ns.push(node);
3738 }
3739 }
3740 XPathValue::NodeSet(ns)
3741 } else if typ == xmlXPathObjectType::XPATH_BOOLEAN as c_int {
3742 XPathValue::Boolean((*obj).boolval != 0)
3743 } else if typ == xmlXPathObjectType::XPATH_NUMBER as c_int {
3744 XPathValue::Number((*obj).floatval)
3745 } else if typ == xmlXPathObjectType::XPATH_STRING as c_int {
3746 let s_ptr = (*obj).stringval;
3747 if s_ptr.is_null() {
3748 XPathValue::String(String::new())
3749 } else {
3750 let s = CStr::from_ptr(s_ptr as *const c_char)
3751 .to_string_lossy()
3752 .into_owned();
3753 XPathValue::String(s)
3754 }
3755 } else {
3756 XPathValue::Boolean(false)
3758 }
3759}
3760
3761static COMPILED_EXPRS: Lazy<Mutex<HashMap<u64, Box<CompiledExpr>>>> =
3767 Lazy::new(|| Mutex::new(HashMap::new()));
3768static NEXT_COMPILED_KEY: Lazy<Mutex<u64>> = Lazy::new(|| Mutex::new(1));
3769
3770type CXPathFunc = unsafe extern "C" fn(*mut c_void, c_int);
3780
3781#[derive(Clone, Copy, PartialEq, Eq, Hash)]
3784struct SendSyncPtr(*mut c_void);
3785unsafe impl Send for SendSyncPtr {}
3786unsafe impl Sync for SendSyncPtr {}
3787
3788static C_FUNCTIONS: Lazy<Mutex<HashMap<(SendSyncPtr, String), CXPathFunc>>> =
3789 Lazy::new(|| Mutex::new(HashMap::new()));
3790
3791fn c_func_stub(_ctx: &mut XPathContext, _args: &[XPathValue]) -> Result<XPathValue, String> {
3796 Err(
3797 "C extension function cannot be called from Rust evaluator without a parser-context bridge"
3798 .to_string(),
3799 )
3800}
3801
3802#[no_mangle]
3815pub unsafe extern "C" fn xmlXPathNewContext(doc: *mut _xmlDoc) -> *mut _xmlXPathContext {
3816 let ctxt = xmlMallocZero(size_of::<_xmlXPathContext>()) as *mut _xmlXPathContext;
3817 if ctxt.is_null() {
3818 return ptr::null_mut();
3819 }
3820
3821 (*ctxt).doc = doc;
3823 (*ctxt).node = ptr::null_mut();
3824 (*ctxt).contextSize = 1;
3825 (*ctxt).proximityPosition = 1;
3826
3827 let internal = Box::new(XPathContext::new(doc));
3829 (*ctxt).extra = Box::into_raw(internal) as *mut c_void;
3830
3831 ctxt
3832}
3833
3834#[no_mangle]
3842pub unsafe extern "C" fn xmlXPathFreeContext(ctxt: *mut _xmlXPathContext) {
3843 if ctxt.is_null() {
3844 return;
3845 }
3846 if !(*ctxt).extra.is_null() {
3848 let _ = Box::from_raw((*ctxt).extra as *mut XPathContext);
3849 (*ctxt).extra = ptr::null_mut();
3850 }
3851 xmlFree(ctxt as *mut c_void);
3853}
3854
3855#[no_mangle]
3864pub unsafe extern "C" fn xmlXPathEvalExpression(
3865 str_: *const xmlChar,
3866 ctxt: *mut _xmlXPathContext,
3867) -> *mut _xmlXPathObject {
3868 if str_.is_null() || ctxt.is_null() {
3869 return ptr::null_mut();
3870 }
3871 let expr_str = match CStr::from_ptr(str_ as *const c_char).to_str() {
3872 Ok(s) => s,
3873 Err(_) => return ptr::null_mut(),
3874 };
3875 let internal = (*ctxt).extra as *mut XPathContext;
3876 if internal.is_null() {
3877 return ptr::null_mut();
3878 }
3879 let internal = &mut *internal;
3880
3881 match crate::xml::xpath::evaluate_str(expr_str, internal) {
3882 Some(val) => xpath_to_object(val),
3883 None => ptr::null_mut(),
3884 }
3885}
3886
3887#[no_mangle]
3895pub unsafe extern "C" fn xmlXPathEval(
3896 str_: *const xmlChar,
3897 ctxt: *mut _xmlXPathContext,
3898) -> *mut _xmlXPathObject {
3899 xmlXPathEvalExpression(str_, ctxt)
3900}
3901
3902#[no_mangle]
3913pub unsafe extern "C" fn xmlXPathFreeObject(obj: *mut _xmlXPathObject) {
3914 if obj.is_null() {
3915 return;
3916 }
3917 let typ = (*obj).type_;
3918 if typ == xmlXPathObjectType::XPATH_STRING as c_int {
3920 if !(*obj).stringval.is_null() {
3921 xmlFree((*obj).stringval as *mut c_void);
3922 (*obj).stringval = ptr::null_mut();
3923 }
3924 }
3925 if typ == xmlXPathObjectType::XPATH_NODESET as c_int {
3927 let ns = (*obj).nodesetval as *mut _xmlNodeSet;
3928 if !ns.is_null() {
3929 if !(*ns).nodeTab.is_null() {
3930 xmlFree((*ns).nodeTab as *mut c_void);
3931 }
3932 xmlFree(ns as *mut c_void);
3933 }
3934 (*obj).nodesetval = ptr::null_mut();
3935 }
3936 xmlFree(obj as *mut c_void);
3937}
3938
3939#[no_mangle]
3950pub unsafe extern "C" fn xmlXPathCompile(str_: *const xmlChar) -> *mut c_void {
3951 if str_.is_null() {
3952 return ptr::null_mut();
3953 }
3954 let expr_str = match CStr::from_ptr(str_ as *const c_char).to_str() {
3955 Ok(s) => s,
3956 Err(_) => return ptr::null_mut(),
3957 };
3958
3959 match crate::xml::xpath::compile(expr_str) {
3960 Some(compiled) => {
3961 let mut map = COMPILED_EXPRS.lock();
3962 let mut counter = NEXT_COMPILED_KEY.lock();
3963 let key = *counter;
3964 *counter += 1;
3965 map.insert(key, Box::new(compiled));
3966 key as *mut c_void
3967 }
3968 None => ptr::null_mut(),
3969 }
3970}
3971
3972#[no_mangle]
3980pub unsafe extern "C" fn xmlXPathFreeCompExpr(comp: *mut c_void) {
3981 if comp.is_null() {
3982 return;
3983 }
3984 let mut map = COMPILED_EXPRS.lock();
3985 map.remove(&(comp as u64));
3986}
3987
3988#[no_mangle]
3997pub unsafe extern "C" fn xmlXPathRegisterNs(
3998 ctxt: *mut _xmlXPathContext,
3999 prefix: *const xmlChar,
4000 ns_uri: *const xmlChar,
4001) -> c_int {
4002 if ctxt.is_null() || prefix.is_null() || ns_uri.is_null() {
4003 return -1;
4004 }
4005 let internal = (*ctxt).extra as *mut XPathContext;
4006 if internal.is_null() {
4007 return -1;
4008 }
4009 let internal = &mut *internal;
4010
4011 let prefix_str = match CStr::from_ptr(prefix as *const c_char).to_str() {
4012 Ok(s) => s,
4013 Err(_) => return -1,
4014 };
4015 let uri_str = match CStr::from_ptr(ns_uri as *const c_char).to_str() {
4016 Ok(s) => s,
4017 Err(_) => return -1,
4018 };
4019
4020 internal.register_namespace(prefix_str, uri_str);
4021 0
4022}
4023
4024#[no_mangle]
4038pub unsafe extern "C" fn xmlXPathRegisterFunc(
4039 ctxt: *mut _xmlXPathContext,
4040 name: *const xmlChar,
4041 f: Option<unsafe extern "C" fn(*mut c_void, c_int)>,
4042) -> c_int {
4043 if ctxt.is_null() || name.is_null() {
4044 return -1;
4045 }
4046 let internal = (*ctxt).extra as *mut XPathContext;
4047 if internal.is_null() {
4048 return -1;
4049 }
4050 let internal = &mut *internal;
4051
4052 let name_str = match CStr::from_ptr(name as *const c_char).to_str() {
4053 Ok(s) => s,
4054 Err(_) => return -1,
4055 };
4056
4057 if let Some(func) = f {
4058 let key = (SendSyncPtr((*ctxt).extra), name_str.to_string());
4060 C_FUNCTIONS.lock().insert(key, func);
4061 internal.register_function(name_str, c_func_stub);
4063 }
4064 0
4065}
4066
4067#[no_mangle]
4077pub unsafe extern "C" fn xmlXPathRegisterFuncNS(
4078 ctxt: *mut _xmlXPathContext,
4079 name: *const xmlChar,
4080 ns_uri: *const xmlChar,
4081 f: Option<unsafe extern "C" fn(*mut c_void, c_int)>,
4082) -> c_int {
4083 if ctxt.is_null() || name.is_null() {
4084 return -1;
4085 }
4086 let internal = (*ctxt).extra as *mut XPathContext;
4087 if internal.is_null() {
4088 return -1;
4089 }
4090 let internal = &mut *internal;
4091
4092 let name_str = match CStr::from_ptr(name as *const c_char).to_str() {
4093 Ok(s) => s,
4094 Err(_) => return -1,
4095 };
4096 let ns_str = if ns_uri.is_null() {
4097 String::new()
4098 } else {
4099 match CStr::from_ptr(ns_uri as *const c_char).to_str() {
4100 Ok(s) => s.to_string(),
4101 Err(_) => return -1,
4102 }
4103 };
4104
4105 let qualified = if ns_str.is_empty() {
4107 name_str.to_string()
4108 } else {
4109 format!("{{{}}}{}", ns_str, name_str)
4110 };
4111
4112 if let Some(func) = f {
4113 let key = (SendSyncPtr((*ctxt).extra), qualified.clone());
4114 C_FUNCTIONS.lock().insert(key, func);
4115 internal.register_function(&qualified, c_func_stub);
4116 }
4117 0
4118}
4119
4120#[no_mangle]
4129pub unsafe extern "C" fn xmlXPathRegisterVariable(
4130 ctxt: *mut _xmlXPathContext,
4131 name: *const xmlChar,
4132 value: *mut _xmlXPathObject,
4133) -> c_int {
4134 if ctxt.is_null() || name.is_null() || value.is_null() {
4135 return -1;
4136 }
4137 let internal = (*ctxt).extra as *mut XPathContext;
4138 if internal.is_null() {
4139 return -1;
4140 }
4141 let internal = &mut *internal;
4142
4143 let name_str = match CStr::from_ptr(name as *const c_char).to_str() {
4144 Ok(s) => s,
4145 Err(_) => return -1,
4146 };
4147
4148 let xpath_val = object_to_xpathvalue(value);
4149 internal.register_variable(name_str, xpath_val);
4150 0
4151}
4152
4153#[no_mangle]
4161pub unsafe extern "C" fn xmlXPathNewNodeSet(val: *mut _xmlNode) -> *mut _xmlXPathObject {
4162 let ns = if val.is_null() {
4163 NodeSet::new()
4164 } else {
4165 NodeSet::singleton(val)
4166 };
4167 xpath_to_object(XPathValue::NodeSet(ns))
4168}
4169
4170#[no_mangle]
4178pub unsafe extern "C" fn xmlXPathNewCString(val: *const xmlChar) -> *mut _xmlXPathObject {
4179 if val.is_null() {
4180 return xpath_to_object(XPathValue::String(String::new()));
4181 }
4182 let s = match CStr::from_ptr(val as *const c_char).to_str() {
4183 Ok(s) => s.to_string(),
4184 Err(_) => return ptr::null_mut(),
4185 };
4186 xpath_to_object(XPathValue::String(s))
4187}
4188
4189#[no_mangle]
4197pub extern "C" fn xmlXPathNewFloat(val: f64) -> *mut _xmlXPathObject {
4198 unsafe { xpath_to_object(XPathValue::Number(val)) }
4199}
4200
4201#[no_mangle]
4209pub extern "C" fn xmlXPathNewBoolean(val: c_int) -> *mut _xmlXPathObject {
4210 unsafe { xpath_to_object(XPathValue::Boolean(val != 0)) }
4211}
4212
4213#[no_mangle]
4227pub unsafe extern "C" fn xmlXPtrEval(expr: *const c_char, doc: *mut _xmlDoc) -> *mut _xmlNode {
4228 crate::xml::xpointer::xmlXPtrEval(expr, doc)
4229}
4230
4231#[no_mangle]
4243pub unsafe extern "C" fn xmlXIncludeProcess(doc: *mut _xmlDoc) -> c_int {
4244 crate::xml::xinclude::xinclude_process(doc)
4245}
4246
4247#[no_mangle]
4255pub unsafe extern "C" fn xmlXIncludeProcessFlags(doc: *mut _xmlDoc, flags: c_int) -> c_int {
4256 crate::xml::xinclude::xinclude_process_flags(doc, flags)
4257}
4258
4259#[no_mangle]
4271pub extern "C" fn xmlCatalogLoad(catalogs: *const c_char) -> *mut c_void {
4272 if catalogs.is_null() {
4273 return ptr::null_mut();
4274 }
4275 crate::xml::catalog::load_catalog(catalogs)
4276}
4277
4278#[no_mangle]
4286pub unsafe extern "C" fn xmlCatalogResolvePublic(pubID: *const xmlChar) -> *mut xmlChar {
4287 if pubID.is_null() {
4288 return ptr::null_mut();
4289 }
4290 crate::xml::catalog::resolve_public(pubID)
4291}
4292
4293#[no_mangle]
4301pub unsafe extern "C" fn xmlCatalogResolveSystem(sysID: *const xmlChar) -> *mut xmlChar {
4302 if sysID.is_null() {
4303 return ptr::null_mut();
4304 }
4305 crate::xml::catalog::resolve_system(sysID)
4306}
4307
4308#[no_mangle]
4316pub unsafe extern "C" fn xmlCatalogResolveURI(URI: *const xmlChar) -> *mut xmlChar {
4317 if URI.is_null() {
4318 return ptr::null_mut();
4319 }
4320 crate::xml::catalog::resolve_uri(URI)
4321}
4322
4323#[no_mangle]
4331pub extern "C" fn xmlCatalogSetDefaults(allow: c_int) {
4332 crate::xml::catalog::set_defaults(allow)
4333}
4334
4335#[no_mangle]
4343pub extern "C" fn xmlCatalogGetDefaults() -> c_int {
4344 crate::xml::catalog::get_defaults()
4345}
4346
4347#[no_mangle]
4355pub unsafe extern "C" fn xmlCatalogAdd(
4356 type_: *const xmlChar,
4357 orig: *const xmlChar,
4358 replace: *const xmlChar,
4359) -> c_int {
4360 if type_.is_null() || orig.is_null() || replace.is_null() {
4361 return -1;
4362 }
4363 crate::xml::catalog::add(type_, orig, replace)
4364}
4365
4366#[no_mangle]
4374pub unsafe extern "C" fn xmlCatalogRemove(value: *const xmlChar) -> c_int {
4375 if value.is_null() {
4376 return 0;
4377 }
4378 crate::xml::catalog::remove(value)
4379}
4380
4381#[no_mangle]
4389pub extern "C" fn xmlCatalogCleanup() {
4390 crate::xml::catalog::cleanup();
4391}
4392
4393#[no_mangle]
4401pub extern "C" fn xmlCatalogConvert() -> *mut _xmlDoc {
4402 unsafe { crate::xml::catalog::convert() }
4404}
4405
4406#[no_mangle]
4418pub unsafe extern "C" fn htmlParseFile(
4419 _filename: *const c_char,
4420 _encoding: *const c_char,
4421) -> *mut _xmlDoc {
4422 ptr::null_mut()
4424}
4425
4426#[no_mangle]
4434pub unsafe extern "C" fn htmlParseMemory(_buffer: *const c_char, _size: c_int) -> *mut _xmlDoc {
4435 ptr::null_mut()
4437}
4438
4439#[no_mangle]
4447pub unsafe extern "C" fn htmlParseDoc(
4448 _cur: *const xmlChar,
4449 _encoding: *const c_char,
4450) -> *mut _xmlDoc {
4451 ptr::null_mut()
4453}
4454
4455#[no_mangle]
4464pub unsafe extern "C" fn htmlCreateFileParserCtxt(
4465 _filename: *const c_char,
4466 _encoding: *const c_char,
4467) -> *mut c_void {
4468 ptr::null_mut()
4470}
4471
4472#[no_mangle]
4480pub extern "C" fn htmlFreeParserCtxt(_ctxt: *mut c_void) {
4481 }
4483
4484#[no_mangle]
4492pub extern "C" fn htmlInitParser() {
4493 }
4495
4496#[no_mangle]
4504pub extern "C" fn htmlCleanupParser() {
4505 }
4507
4508#[no_mangle]
4520pub unsafe extern "C" fn xmlNewValidCtxt() -> *mut _xmlValidCtxt {
4521 crate::xml::validation::new_valid_ctxt()
4522}
4523
4524#[no_mangle]
4532pub unsafe extern "C" fn xmlFreeValidCtxt(ctxt: *mut _xmlValidCtxt) {
4533 crate::xml::validation::free_valid_ctxt(ctxt);
4534}
4535
4536#[no_mangle]
4547pub unsafe extern "C" fn xmlSetValidErrors(
4548 ctxt: *mut _xmlValidCtxt,
4549 err: Option<xmlGenericErrorFunc>,
4550 warn: Option<xmlGenericErrorFunc>,
4551 data: *mut c_void,
4552) {
4553 crate::xml::validation::set_valid_errors(ctxt, err, warn, data);
4554}
4555
4556#[no_mangle]
4564pub unsafe extern "C" fn xmlValidateDocument(
4565 ctxt: *mut _xmlValidCtxt,
4566 doc: *mut _xmlDoc,
4567) -> c_int {
4568 crate::xml::validation::validate_document(ctxt, doc)
4569}
4570
4571#[no_mangle]
4579pub unsafe extern "C" fn xmlValidateDocumentFinal(
4580 ctxt: *mut _xmlValidCtxt,
4581 doc: *mut _xmlDoc,
4582) -> c_int {
4583 crate::xml::validation::validate_document_final(ctxt, doc)
4584}
4585
4586#[no_mangle]
4596pub unsafe extern "C" fn xmlValidateElement(
4597 ctxt: *mut _xmlValidCtxt,
4598 doc: *mut _xmlDoc,
4599 elem: *mut _xmlNode,
4600) -> c_int {
4601 crate::xml::validation::validate_element(ctxt, doc, elem)
4602}
4603
4604#[no_mangle]
4615pub unsafe extern "C" fn xmlValidateAttributeDecl(
4616 ctxt: *mut _xmlValidCtxt,
4617 doc: *mut _xmlDoc,
4618 elem: *mut _xmlNode,
4619 attr: *mut _xmlAttribute,
4620) -> c_int {
4621 crate::xml::validation::validate_attribute_decl(ctxt, doc, elem, attr)
4622}
4623
4624#[no_mangle]
4632pub unsafe extern "C" fn xmlValidateAttributeValue(
4633 atype: c_int,
4634 value: *const xmlChar,
4635) -> c_int {
4636 crate::xml::validation::validate_attribute_value(atype, value)
4637}
4638
4639#[no_mangle]
4649pub unsafe extern "C" fn xmlValidateNotationUse(
4650 ctxt: *mut _xmlValidCtxt,
4651 doc: *mut _xmlDoc,
4652 notation_name: *const xmlChar,
4653) -> c_int {
4654 crate::xml::validation::validate_notation_use(ctxt, doc, notation_name)
4655}
4656
4657#[no_mangle]
4668pub unsafe extern "C" fn xmlValidateID(
4669 ctxt: *mut _xmlValidCtxt,
4670 doc: *mut _xmlDoc,
4671 node: *mut _xmlNode,
4672 value: *const xmlChar,
4673) -> c_int {
4674 crate::xml::validation::validate_id(ctxt, doc, node, value)
4675}
4676
4677#[no_mangle]
4688pub unsafe extern "C" fn xmlValidateIDRef(
4689 ctxt: *mut _xmlValidCtxt,
4690 doc: *mut _xmlDoc,
4691 node: *mut _xmlNode,
4692 value: *const xmlChar,
4693) -> c_int {
4694 crate::xml::validation::validate_id_ref(ctxt, doc, node, value)
4695}
4696
4697#[no_mangle]
4708pub unsafe extern "C" fn xmlValidateIDRefs(
4709 ctxt: *mut _xmlValidCtxt,
4710 doc: *mut _xmlDoc,
4711 node: *mut _xmlNode,
4712 value: *const xmlChar,
4713) -> c_int {
4714 crate::xml::validation::validate_id_refs(ctxt, doc, node, value)
4715}
4716
4717#[no_mangle]
4725pub unsafe extern "C" fn xmlValidateNmtoken(value: *const xmlChar) -> c_int {
4726 crate::xml::validation::validate_nmtoken(value)
4727}
4728
4729#[no_mangle]
4737pub unsafe extern "C" fn xmlValidateNmtokens(value: *const xmlChar) -> c_int {
4738 crate::xml::validation::validate_nmtokens(value)
4739}
4740
4741#[no_mangle]
4749pub unsafe extern "C" fn xmlValidateName(value: *const xmlChar) -> c_int {
4750 crate::xml::validation::validate_name(value)
4751}
4752
4753#[no_mangle]
4761pub unsafe extern "C" fn xmlValidateNames(value: *const xmlChar) -> c_int {
4762 crate::xml::validation::validate_names(value)
4763}
4764
4765#[no_mangle]
4773pub unsafe extern "C" fn xmlValidateRoot(
4774 ctxt: *mut _xmlValidCtxt,
4775 doc: *mut _xmlDoc,
4776) -> c_int {
4777 crate::xml::validation::validate_root(ctxt, doc)
4778}
4779
4780#[no_mangle]
4790pub unsafe extern "C" fn xmlValidateContent(
4791 ctxt: *mut _xmlValidCtxt,
4792 node: *mut _xmlNode,
4793 doc: *mut _xmlDoc,
4794) -> c_int {
4795 crate::xml::validation::validate_content(ctxt, node, doc)
4796}
4797
4798#[no_mangle]
4806pub unsafe extern "C" fn xmlIsMixedElement(
4807 doc: *mut _xmlDoc,
4808 name: *const xmlChar,
4809) -> c_int {
4810 crate::xml::validation::is_mixed_element(doc, name)
4811}
4812
4813#[no_mangle]
4821pub unsafe extern "C" fn xmlIsEmptyElement(
4822 doc: *mut _xmlDoc,
4823 name: *const xmlChar,
4824) -> c_int {
4825 crate::xml::validation::is_empty_element(doc, name)
4826}
4827
4828#[no_mangle]
4838pub unsafe extern "C" fn xmlValidateDtd(
4839 ctxt: *mut _xmlValidCtxt,
4840 doc: *mut _xmlDoc,
4841 dtd: *mut _xmlDtd,
4842) -> c_int {
4843 crate::xml::validation::validate_dtd(ctxt, doc, dtd)
4844}
4845
4846#[no_mangle]
4854pub unsafe extern "C" fn xmlValidateDtdFinal(
4855 ctxt: *mut _xmlValidCtxt,
4856 doc: *mut _xmlDoc,
4857) -> c_int {
4858 crate::xml::validation::validate_dtd_final(ctxt, doc)
4859}
4860
4861#[no_mangle]
4871pub unsafe extern "C" fn xmlValidateEnumeration(
4872 ctxt: *mut _xmlValidCtxt,
4873 value: *const xmlChar,
4874 tree: *mut _xmlEnumeration,
4875) -> c_int {
4876 crate::xml::validation::validate_enumeration(ctxt, value, tree)
4877}
4878
4879#[no_mangle]
4891pub unsafe extern "C" fn xmlDebugDumpDocument(_output: *mut c_void, _doc: *mut _xmlDoc) {
4892 }
4894
4895#[no_mangle]
4903pub unsafe extern "C" fn xmlDebugDumpNode(_output: *mut c_void, _node: *mut _xmlNode) {
4904 }
4906
4907#[no_mangle]
4915pub unsafe extern "C" fn xmlDebugDumpNodeList(_output: *mut c_void, _node: *mut _xmlNode) {
4916 }
4918
4919#[no_mangle]
4927pub extern "C" fn xmlGetBinaryPath() -> *mut c_char {
4928 ptr::null_mut()
4930}
4931
4932#[no_mangle]
4940pub extern "C" fn xmlGetHomeOfBinary() -> *mut c_char {
4941 ptr::null_mut()
4943}