1 | |
---|
2 | /* |
---|
3 | * Summary: text writing API for XML |
---|
4 | * Description: text writing API for XML |
---|
5 | * |
---|
6 | * Copy: See Copyright for the status of this software. |
---|
7 | * |
---|
8 | * Author: Alfred Mickautsch <alfred@mickautsch.de> |
---|
9 | */ |
---|
10 | |
---|
11 | #ifndef __XML_XMLWRITER_H__ |
---|
12 | #define __XML_XMLWRITER_H__ |
---|
13 | |
---|
14 | #include <libxml/xmlversion.h> |
---|
15 | |
---|
16 | #ifdef LIBXML_WRITER_ENABLED |
---|
17 | |
---|
18 | #include <stdarg.h> |
---|
19 | #include <libxml/xmlIO.h> |
---|
20 | #include <libxml/list.h> |
---|
21 | #include <libxml/xmlstring.h> |
---|
22 | |
---|
23 | #ifdef __cplusplus |
---|
24 | extern "C" { |
---|
25 | #endif |
---|
26 | |
---|
27 | typedef struct _xmlTextWriter xmlTextWriter; |
---|
28 | typedef xmlTextWriter *xmlTextWriterPtr; |
---|
29 | |
---|
30 | /* |
---|
31 | * Constructors & Destructor |
---|
32 | */ |
---|
33 | XMLPUBFUN xmlTextWriterPtr XMLCALL |
---|
34 | xmlNewTextWriter(xmlOutputBufferPtr out); |
---|
35 | XMLPUBFUN xmlTextWriterPtr XMLCALL |
---|
36 | xmlNewTextWriterFilename(const char *uri, int compression); |
---|
37 | XMLPUBFUN xmlTextWriterPtr XMLCALL |
---|
38 | xmlNewTextWriterMemory(xmlBufferPtr buf, int compression); |
---|
39 | XMLPUBFUN xmlTextWriterPtr XMLCALL |
---|
40 | xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression); |
---|
41 | XMLPUBFUN xmlTextWriterPtr XMLCALL |
---|
42 | xmlNewTextWriterDoc(xmlDocPtr * doc, int compression); |
---|
43 | XMLPUBFUN xmlTextWriterPtr XMLCALL |
---|
44 | xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, |
---|
45 | int compression); |
---|
46 | XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer); |
---|
47 | |
---|
48 | /* |
---|
49 | * Functions |
---|
50 | */ |
---|
51 | |
---|
52 | |
---|
53 | /* |
---|
54 | * Document |
---|
55 | */ |
---|
56 | XMLPUBFUN intptr_t XMLCALL |
---|
57 | xmlTextWriterStartDocument(xmlTextWriterPtr writer, |
---|
58 | const char *version, |
---|
59 | const char *encoding, |
---|
60 | const char *standalone); |
---|
61 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr |
---|
62 | writer); |
---|
63 | |
---|
64 | /* |
---|
65 | * Comments |
---|
66 | */ |
---|
67 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr |
---|
68 | writer); |
---|
69 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer); |
---|
70 | XMLPUBFUN intptr_t XMLCALL |
---|
71 | xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer, |
---|
72 | const char *format, ...); |
---|
73 | XMLPUBFUN intptr_t XMLCALL |
---|
74 | xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, |
---|
75 | const char *format, |
---|
76 | va_list argptr); |
---|
77 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr |
---|
78 | writer, |
---|
79 | const xmlChar * |
---|
80 | content); |
---|
81 | |
---|
82 | /* |
---|
83 | * Elements |
---|
84 | */ |
---|
85 | XMLPUBFUN intptr_t XMLCALL |
---|
86 | xmlTextWriterStartElement(xmlTextWriterPtr writer, |
---|
87 | const xmlChar * name); |
---|
88 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr |
---|
89 | writer, |
---|
90 | const xmlChar * |
---|
91 | prefix, |
---|
92 | const xmlChar * name, |
---|
93 | const xmlChar * |
---|
94 | namespaceURI); |
---|
95 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer); |
---|
96 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr |
---|
97 | writer); |
---|
98 | |
---|
99 | /* |
---|
100 | * Elements conveniency functions |
---|
101 | */ |
---|
102 | XMLPUBFUN intptr_t XMLCALL |
---|
103 | xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer, |
---|
104 | const xmlChar * name, |
---|
105 | const char *format, ...); |
---|
106 | XMLPUBFUN intptr_t XMLCALL |
---|
107 | xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer, |
---|
108 | const xmlChar * name, |
---|
109 | const char *format, |
---|
110 | va_list argptr); |
---|
111 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr |
---|
112 | writer, |
---|
113 | const xmlChar * name, |
---|
114 | const xmlChar * |
---|
115 | content); |
---|
116 | XMLPUBFUN intptr_t XMLCALL |
---|
117 | xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer, |
---|
118 | const xmlChar * prefix, |
---|
119 | const xmlChar * name, |
---|
120 | const xmlChar * namespaceURI, |
---|
121 | const char *format, ...); |
---|
122 | XMLPUBFUN intptr_t XMLCALL |
---|
123 | xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer, |
---|
124 | const xmlChar * prefix, |
---|
125 | const xmlChar * name, |
---|
126 | const xmlChar * namespaceURI, |
---|
127 | const char *format, |
---|
128 | va_list argptr); |
---|
129 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr |
---|
130 | writer, |
---|
131 | const xmlChar * |
---|
132 | prefix, |
---|
133 | const xmlChar * name, |
---|
134 | const xmlChar * |
---|
135 | namespaceURI, |
---|
136 | const xmlChar * |
---|
137 | content); |
---|
138 | |
---|
139 | /* |
---|
140 | * Text |
---|
141 | */ |
---|
142 | XMLPUBFUN intptr_t XMLCALL |
---|
143 | xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, |
---|
144 | const char *format, ...); |
---|
145 | XMLPUBFUN intptr_t XMLCALL |
---|
146 | xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, |
---|
147 | const char *format, va_list argptr); |
---|
148 | XMLPUBFUN intptr_t XMLCALL |
---|
149 | xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, |
---|
150 | const xmlChar * content, intptr_t len); |
---|
151 | XMLPUBFUN intptr_t XMLCALL |
---|
152 | xmlTextWriterWriteRaw(xmlTextWriterPtr writer, |
---|
153 | const xmlChar * content); |
---|
154 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr |
---|
155 | writer, |
---|
156 | const char |
---|
157 | *format, ...); |
---|
158 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr |
---|
159 | writer, |
---|
160 | const char |
---|
161 | *format, |
---|
162 | va_list argptr); |
---|
163 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer, |
---|
164 | const xmlChar * |
---|
165 | content); |
---|
166 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer, |
---|
167 | const char *data, |
---|
168 | intptr_t start, intptr_t len); |
---|
169 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, |
---|
170 | const char *data, |
---|
171 | intptr_t start, intptr_t len); |
---|
172 | |
---|
173 | /* |
---|
174 | * Attributes |
---|
175 | */ |
---|
176 | XMLPUBFUN intptr_t XMLCALL |
---|
177 | xmlTextWriterStartAttribute(xmlTextWriterPtr writer, |
---|
178 | const xmlChar * name); |
---|
179 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr |
---|
180 | writer, |
---|
181 | const xmlChar * |
---|
182 | prefix, |
---|
183 | const xmlChar * |
---|
184 | name, |
---|
185 | const xmlChar * |
---|
186 | namespaceURI); |
---|
187 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr |
---|
188 | writer); |
---|
189 | |
---|
190 | /* |
---|
191 | * Attributes conveniency functions |
---|
192 | */ |
---|
193 | XMLPUBFUN intptr_t XMLCALL |
---|
194 | xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer, |
---|
195 | const xmlChar * name, |
---|
196 | const char *format, ...); |
---|
197 | XMLPUBFUN intptr_t XMLCALL |
---|
198 | xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer, |
---|
199 | const xmlChar * name, |
---|
200 | const char *format, |
---|
201 | va_list argptr); |
---|
202 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr |
---|
203 | writer, |
---|
204 | const xmlChar * name, |
---|
205 | const xmlChar * |
---|
206 | content); |
---|
207 | XMLPUBFUN intptr_t XMLCALL |
---|
208 | xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer, |
---|
209 | const xmlChar * prefix, |
---|
210 | const xmlChar * name, |
---|
211 | const xmlChar * namespaceURI, |
---|
212 | const char *format, ...); |
---|
213 | XMLPUBFUN intptr_t XMLCALL |
---|
214 | xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer, |
---|
215 | const xmlChar * prefix, |
---|
216 | const xmlChar * name, |
---|
217 | const xmlChar * namespaceURI, |
---|
218 | const char *format, |
---|
219 | va_list argptr); |
---|
220 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr |
---|
221 | writer, |
---|
222 | const xmlChar * |
---|
223 | prefix, |
---|
224 | const xmlChar * |
---|
225 | name, |
---|
226 | const xmlChar * |
---|
227 | namespaceURI, |
---|
228 | const xmlChar * |
---|
229 | content); |
---|
230 | |
---|
231 | /* |
---|
232 | * PI's |
---|
233 | */ |
---|
234 | XMLPUBFUN intptr_t XMLCALL |
---|
235 | xmlTextWriterStartPI(xmlTextWriterPtr writer, |
---|
236 | const xmlChar * target); |
---|
237 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer); |
---|
238 | |
---|
239 | /* |
---|
240 | * PI conveniency functions |
---|
241 | */ |
---|
242 | XMLPUBFUN intptr_t XMLCALL |
---|
243 | xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, |
---|
244 | const xmlChar * target, |
---|
245 | const char *format, ...); |
---|
246 | XMLPUBFUN intptr_t XMLCALL |
---|
247 | xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer, |
---|
248 | const xmlChar * target, |
---|
249 | const char *format, va_list argptr); |
---|
250 | XMLPUBFUN intptr_t XMLCALL |
---|
251 | xmlTextWriterWritePI(xmlTextWriterPtr writer, |
---|
252 | const xmlChar * target, |
---|
253 | const xmlChar * content); |
---|
254 | |
---|
255 | /** |
---|
256 | * xmlTextWriterWriteProcessingInstruction: |
---|
257 | * |
---|
258 | * This macro maps to xmlTextWriterWritePI |
---|
259 | */ |
---|
260 | #define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI |
---|
261 | |
---|
262 | /* |
---|
263 | * CDATA |
---|
264 | */ |
---|
265 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer); |
---|
266 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer); |
---|
267 | |
---|
268 | /* |
---|
269 | * CDATA conveniency functions |
---|
270 | */ |
---|
271 | XMLPUBFUN intptr_t XMLCALL |
---|
272 | xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, |
---|
273 | const char *format, ...); |
---|
274 | XMLPUBFUN intptr_t XMLCALL |
---|
275 | xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, |
---|
276 | const char *format, va_list argptr); |
---|
277 | XMLPUBFUN intptr_t XMLCALL |
---|
278 | xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, |
---|
279 | const xmlChar * content); |
---|
280 | |
---|
281 | /* |
---|
282 | * DTD |
---|
283 | */ |
---|
284 | XMLPUBFUN intptr_t XMLCALL |
---|
285 | xmlTextWriterStartDTD(xmlTextWriterPtr writer, |
---|
286 | const xmlChar * name, |
---|
287 | const xmlChar * pubid, |
---|
288 | const xmlChar * sysid); |
---|
289 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer); |
---|
290 | |
---|
291 | /* |
---|
292 | * DTD conveniency functions |
---|
293 | */ |
---|
294 | XMLPUBFUN intptr_t XMLCALL |
---|
295 | xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer, |
---|
296 | const xmlChar * name, |
---|
297 | const xmlChar * pubid, |
---|
298 | const xmlChar * sysid, |
---|
299 | const char *format, ...); |
---|
300 | XMLPUBFUN intptr_t XMLCALL |
---|
301 | xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer, |
---|
302 | const xmlChar * name, |
---|
303 | const xmlChar * pubid, |
---|
304 | const xmlChar * sysid, |
---|
305 | const char *format, va_list argptr); |
---|
306 | XMLPUBFUN intptr_t XMLCALL |
---|
307 | xmlTextWriterWriteDTD(xmlTextWriterPtr writer, |
---|
308 | const xmlChar * name, |
---|
309 | const xmlChar * pubid, |
---|
310 | const xmlChar * sysid, |
---|
311 | const xmlChar * subset); |
---|
312 | |
---|
313 | /** |
---|
314 | * xmlTextWriterWriteDocType: |
---|
315 | * |
---|
316 | * this macro maps to xmlTextWriterWriteDTD |
---|
317 | */ |
---|
318 | #define xmlTextWriterWriteDocType xmlTextWriterWriteDTD |
---|
319 | |
---|
320 | /* |
---|
321 | * DTD element definition |
---|
322 | */ |
---|
323 | XMLPUBFUN intptr_t XMLCALL |
---|
324 | xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, |
---|
325 | const xmlChar * name); |
---|
326 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr |
---|
327 | writer); |
---|
328 | |
---|
329 | /* |
---|
330 | * DTD element definition conveniency functions |
---|
331 | */ |
---|
332 | XMLPUBFUN intptr_t XMLCALL |
---|
333 | xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer, |
---|
334 | const xmlChar * name, |
---|
335 | const char *format, ...); |
---|
336 | XMLPUBFUN intptr_t XMLCALL |
---|
337 | xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer, |
---|
338 | const xmlChar * name, |
---|
339 | const char *format, |
---|
340 | va_list argptr); |
---|
341 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr |
---|
342 | writer, |
---|
343 | const xmlChar * |
---|
344 | name, |
---|
345 | const xmlChar * |
---|
346 | content); |
---|
347 | |
---|
348 | /* |
---|
349 | * DTD attribute list definition |
---|
350 | */ |
---|
351 | XMLPUBFUN intptr_t XMLCALL |
---|
352 | xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, |
---|
353 | const xmlChar * name); |
---|
354 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr |
---|
355 | writer); |
---|
356 | |
---|
357 | /* |
---|
358 | * DTD attribute list definition conveniency functions |
---|
359 | */ |
---|
360 | XMLPUBFUN intptr_t XMLCALL |
---|
361 | xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer, |
---|
362 | const xmlChar * name, |
---|
363 | const char *format, ...); |
---|
364 | XMLPUBFUN intptr_t XMLCALL |
---|
365 | xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer, |
---|
366 | const xmlChar * name, |
---|
367 | const char *format, |
---|
368 | va_list argptr); |
---|
369 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr |
---|
370 | writer, |
---|
371 | const xmlChar * |
---|
372 | name, |
---|
373 | const xmlChar * |
---|
374 | content); |
---|
375 | |
---|
376 | /* |
---|
377 | * DTD entity definition |
---|
378 | */ |
---|
379 | XMLPUBFUN intptr_t XMLCALL |
---|
380 | xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer, |
---|
381 | intptr_t pe, const xmlChar * name); |
---|
382 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr |
---|
383 | writer); |
---|
384 | |
---|
385 | /* |
---|
386 | * DTD entity definition conveniency functions |
---|
387 | */ |
---|
388 | XMLPUBFUN intptr_t XMLCALL |
---|
389 | xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer, |
---|
390 | intptr_t pe, |
---|
391 | const xmlChar * name, |
---|
392 | const char *format, ...); |
---|
393 | XMLPUBFUN intptr_t XMLCALL |
---|
394 | xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer, |
---|
395 | intptr_t pe, |
---|
396 | const xmlChar * name, |
---|
397 | const char *format, |
---|
398 | va_list argptr); |
---|
399 | XMLPUBFUN intptr_t XMLCALL |
---|
400 | xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer, |
---|
401 | intptr_t pe, |
---|
402 | const xmlChar * name, |
---|
403 | const xmlChar * content); |
---|
404 | XMLPUBFUN intptr_t XMLCALL |
---|
405 | xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer, |
---|
406 | intptr_t pe, |
---|
407 | const xmlChar * name, |
---|
408 | const xmlChar * pubid, |
---|
409 | const xmlChar * sysid, |
---|
410 | const xmlChar * ndataid); |
---|
411 | XMLPUBFUN intptr_t XMLCALL |
---|
412 | xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr |
---|
413 | writer, |
---|
414 | const xmlChar * pubid, |
---|
415 | const xmlChar * sysid, |
---|
416 | const xmlChar * |
---|
417 | ndataid); |
---|
418 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr |
---|
419 | writer, intptr_t pe, |
---|
420 | const xmlChar * name, |
---|
421 | const xmlChar * |
---|
422 | pubid, |
---|
423 | const xmlChar * |
---|
424 | sysid, |
---|
425 | const xmlChar * |
---|
426 | ndataid, |
---|
427 | const xmlChar * |
---|
428 | content); |
---|
429 | |
---|
430 | /* |
---|
431 | * DTD notation definition |
---|
432 | */ |
---|
433 | XMLPUBFUN intptr_t XMLCALL |
---|
434 | xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer, |
---|
435 | const xmlChar * name, |
---|
436 | const xmlChar * pubid, |
---|
437 | const xmlChar * sysid); |
---|
438 | |
---|
439 | /* |
---|
440 | * Indentation |
---|
441 | */ |
---|
442 | XMLPUBFUN intptr_t XMLCALL |
---|
443 | xmlTextWriterSetIndent(xmlTextWriterPtr writer, intptr_t indent); |
---|
444 | XMLPUBFUN intptr_t XMLCALL |
---|
445 | xmlTextWriterSetIndentString(xmlTextWriterPtr writer, |
---|
446 | const xmlChar * str); |
---|
447 | |
---|
448 | /* |
---|
449 | * misc |
---|
450 | */ |
---|
451 | XMLPUBFUN intptr_t XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer); |
---|
452 | |
---|
453 | #ifdef __cplusplus |
---|
454 | } |
---|
455 | #endif |
---|
456 | |
---|
457 | #endif /* LIBXML_WRITER_ENABLED */ |
---|
458 | |
---|
459 | #endif /* __XML_XMLWRITER_H__ */ |
---|