1#![allow(clippy::upper_case_acronyms)]
4#![allow(non_snake_case, non_camel_case_types)]
5
6use glib::ffi::gpointer;
7
8pub const XML_CHAR_ENCODING_NONE: libc::c_int = 0;
9
10pub const XML_INTERNAL_GENERAL_ENTITY: libc::c_int = 1;
11
12pub const XML_PARSE_NONET: libc::c_int = 1 << 11;
13pub const XML_PARSE_HUGE: libc::c_int = 1 << 19;
14pub const XML_PARSE_BIG_LINES: libc::c_int = 1 << 22;
15
16pub const XML_SAX2_MAGIC: libc::c_uint = 0xDEEDBEAF;
17
18pub const XML_ERR_USER_STOP: libc::c_int = 111; pub type xmlDocPtr = gpointer;
21
22pub type xmlEntityPtr = gpointer;
23
24pub type UnusedFn = Option<unsafe extern "C" fn()>;
25
26#[rustfmt::skip]
27#[repr(C)]
28pub struct xmlSAXHandler {
29 pub internalSubset: UnusedFn,
30 pub isStandalone: UnusedFn,
31 pub hasInternalSubset: UnusedFn,
32 pub hasExternalSubset: UnusedFn,
33 pub resolveEntity: UnusedFn,
34
35 pub getEntity: Option<unsafe extern "C" fn(
36 ctx: *mut libc::c_void,
37 name: *const libc::c_char,
38 ) -> xmlEntityPtr>,
39
40 pub entityDecl: Option<unsafe extern "C" fn(
41 ctx: *mut libc::c_void,
42 name: *const libc::c_char,
43 type_: libc::c_int,
44 public_id: *const libc::c_char,
45 system_id: *const libc::c_char,
46 content: *const libc::c_char,
47 )>,
48
49 pub notationDecl: UnusedFn,
50 pub attributeDecl: UnusedFn,
51 pub elementDecl: UnusedFn,
52
53 pub unparsedEntityDecl: Option<unsafe extern "C" fn(
54 ctx: *mut libc::c_void,
55 name: *const libc::c_char,
56 public_id: *const libc::c_char,
57 system_id: *const libc::c_char,
58 notation_name: *const libc::c_char,
59 )>,
60
61 pub setDocumentLocator: UnusedFn,
62 pub startDocument: UnusedFn,
63 pub endDocument: UnusedFn,
64 pub startElement: UnusedFn,
65 pub endElement: UnusedFn,
66
67 pub reference: UnusedFn,
68
69 pub characters: Option<unsafe extern "C" fn(
70 ctx: *mut libc::c_void,
71 ch: *const libc::c_char,
72 len: libc::c_int,
73 )>,
74
75 pub ignorableWhitespace: UnusedFn,
76
77 pub processingInstruction: Option<unsafe extern "C" fn(
78 ctx: *mut libc::c_void,
79 target: *const libc::c_char,
80 data: *const libc::c_char,
81 )>,
82
83 pub comment: UnusedFn,
84 pub warning: UnusedFn,
85
86 pub error: UnusedFn,
87
88 pub fatalError: UnusedFn,
89
90 pub getParameterEntity: Option<unsafe extern "C" fn(
91 ctx: *mut libc::c_void,
92 name: *const libc::c_char,
93 ) -> xmlEntityPtr>,
94
95 pub cdataBlock: Option<unsafe extern "C" fn(
96 ctx: *mut libc::c_void,
97 value: *const libc::c_char,
98 len: libc::c_int,
99 )>,
100
101 pub externalSubset: UnusedFn,
102
103 pub initialized: libc::c_uint,
104
105 pub _private: gpointer,
106
107 pub startElementNs: Option<unsafe extern "C" fn(
108 ctx: *mut libc::c_void,
109 localname: *mut libc::c_char,
110 prefix: *mut libc::c_char,
111 uri: *mut libc::c_char,
112 nb_namespaces: libc::c_int,
113 namespaces: *mut *mut libc::c_char,
114 nb_attributes: libc::c_int,
115 nb_defaulted: libc::c_int,
116 attributes: *mut *mut libc::c_char,
117 )>,
118
119 pub endElementNs: Option<unsafe extern "C" fn(
120 ctx: *mut libc::c_void,
121 localname: *mut libc::c_char,
122 prefix: *mut libc::c_char,
123 uri: *mut libc::c_char,
124 )>,
125
126 pub serror: Option<unsafe extern "C" fn(user_data: *mut libc::c_void, error: xmlErrorPtr)>,
127}
128
129pub type xmlSAXHandlerPtr = *mut xmlSAXHandler;
130
131#[repr(C)]
139pub struct xmlParserCtxt {
140 pub sax: gpointer,
141 pub userData: gpointer,
142 pub myDoc: xmlDocPtr,
143 pub wellFormed: libc::c_int,
144 pub replaceEntities: libc::c_int,
145 }
147
148pub type xmlParserCtxtPtr = *mut xmlParserCtxt;
149
150#[repr(C)]
151pub struct xmlError {
152 pub domain: libc::c_int,
153 pub code: libc::c_int,
154 pub message: *const libc::c_char,
155 pub level: libc::c_int,
156 pub file: *const libc::c_char,
157 pub line: libc::c_int,
158 pub str1: *const libc::c_char,
159 pub str2: *const libc::c_char,
160 pub str3: *const libc::c_char,
161 pub int1: libc::c_int,
162 pub int2: libc::c_int,
163 pub ctxt: gpointer,
164 pub node: gpointer,
165}
166
167pub type xmlErrorPtr = *mut xmlError;
168
169pub type xmlInputReadCallback = Option<
170 unsafe extern "C" fn(
171 context: *mut libc::c_void,
172 buffer: *mut libc::c_char,
173 len: libc::c_int,
174 ) -> libc::c_int,
175>;
176
177pub type xmlInputCloseCallback =
178 Option<unsafe extern "C" fn(context: *mut libc::c_void) -> libc::c_int>;
179
180pub type xmlCharEncoding = libc::c_int;
181
182unsafe extern "C" {
183 pub fn xmlInitParser();
184
185 pub fn xmlCreateIOParserCtxt(
186 sax: xmlSAXHandlerPtr,
187 user_data: *mut libc::c_void,
188 ioread: xmlInputReadCallback,
189 ioclose: xmlInputCloseCallback,
190 ioctx: *mut libc::c_void,
191 enc: xmlCharEncoding,
192 ) -> xmlParserCtxtPtr;
193
194 pub fn xmlStopParser(ctxt: xmlParserCtxtPtr);
195
196 pub fn xmlParseDocument(ctxt: xmlParserCtxtPtr) -> libc::c_int;
197
198 pub fn xmlFreeDoc(doc: xmlDocPtr);
199
200 pub fn xmlFreeParserCtxt(ctxt: xmlParserCtxtPtr);
201
202 pub fn xmlCtxtGetLastError(ctxt: *mut libc::c_void) -> xmlErrorPtr;
203
204 pub fn xmlCtxtUseOptions(ctxt: xmlParserCtxtPtr, options: libc::c_int) -> libc::c_int;
205
206 pub fn xmlNewEntity(
207 doc: xmlDocPtr,
208 name: *const libc::c_char,
209 type_: libc::c_int,
210 external_id: *const libc::c_char,
211 system_id: *const libc::c_char,
212 content: *const libc::c_char,
213 ) -> xmlEntityPtr;
214}