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