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 <[email protected]>
|
---|
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 int XMLCALL
|
---|
57 | xmlTextWriterStartDocument(xmlTextWriterPtr writer,
|
---|
58 | const char *version,
|
---|
59 | const char *encoding,
|
---|
60 | const char *standalone);
|
---|
61 | XMLPUBFUN int XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr
|
---|
62 | writer);
|
---|
63 |
|
---|
64 | /*
|
---|
65 | * Comments
|
---|
66 | */
|
---|
67 | XMLPUBFUN int XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr
|
---|
68 | writer);
|
---|
69 | XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer);
|
---|
70 | XMLPUBFUN int XMLCALL
|
---|
71 | xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer,
|
---|
72 | const char *format, ...);
|
---|
73 | XMLPUBFUN int XMLCALL
|
---|
74 | xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer,
|
---|
75 | const char *format,
|
---|
76 | va_list argptr);
|
---|
77 | XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr
|
---|
78 | writer,
|
---|
79 | const xmlChar *
|
---|
80 | content);
|
---|
81 |
|
---|
82 | /*
|
---|
83 | * Elements
|
---|
84 | */
|
---|
85 | XMLPUBFUN int XMLCALL
|
---|
86 | xmlTextWriterStartElement(xmlTextWriterPtr writer,
|
---|
87 | const xmlChar * name);
|
---|
88 | XMLPUBFUN int XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr
|
---|
89 | writer,
|
---|
90 | const xmlChar *
|
---|
91 | prefix,
|
---|
92 | const xmlChar * name,
|
---|
93 | const xmlChar *
|
---|
94 | namespaceURI);
|
---|
95 | XMLPUBFUN int XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer);
|
---|
96 | XMLPUBFUN int XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr
|
---|
97 | writer);
|
---|
98 |
|
---|
99 | /*
|
---|
100 | * Elements conveniency functions
|
---|
101 | */
|
---|
102 | XMLPUBFUN int XMLCALL
|
---|
103 | xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer,
|
---|
104 | const xmlChar * name,
|
---|
105 | const char *format, ...);
|
---|
106 | XMLPUBFUN int XMLCALL
|
---|
107 | xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer,
|
---|
108 | const xmlChar * name,
|
---|
109 | const char *format,
|
---|
110 | va_list argptr);
|
---|
111 | XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr
|
---|
112 | writer,
|
---|
113 | const xmlChar * name,
|
---|
114 | const xmlChar *
|
---|
115 | content);
|
---|
116 | XMLPUBFUN int XMLCALL
|
---|
117 | xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer,
|
---|
118 | const xmlChar * prefix,
|
---|
119 | const xmlChar * name,
|
---|
120 | const xmlChar * namespaceURI,
|
---|
121 | const char *format, ...);
|
---|
122 | XMLPUBFUN int 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 int 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 int XMLCALL
|
---|
143 | xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer,
|
---|
144 | const char *format, ...);
|
---|
145 | XMLPUBFUN int XMLCALL
|
---|
146 | xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer,
|
---|
147 | const char *format, va_list argptr);
|
---|
148 | XMLPUBFUN int XMLCALL
|
---|
149 | xmlTextWriterWriteRawLen(xmlTextWriterPtr writer,
|
---|
150 | const xmlChar * content, int len);
|
---|
151 | XMLPUBFUN int XMLCALL
|
---|
152 | xmlTextWriterWriteRaw(xmlTextWriterPtr writer,
|
---|
153 | const xmlChar * content);
|
---|
154 | XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr
|
---|
155 | writer,
|
---|
156 | const char
|
---|
157 | *format, ...);
|
---|
158 | XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr
|
---|
159 | writer,
|
---|
160 | const char
|
---|
161 | *format,
|
---|
162 | va_list argptr);
|
---|
163 | XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer,
|
---|
164 | const xmlChar *
|
---|
165 | content);
|
---|
166 | XMLPUBFUN int XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer,
|
---|
167 | const char *data,
|
---|
168 | int start, int len);
|
---|
169 | XMLPUBFUN int XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer,
|
---|
170 | const char *data,
|
---|
171 | int start, int len);
|
---|
172 |
|
---|
173 | /*
|
---|
174 | * Attributes
|
---|
175 | */
|
---|
176 | XMLPUBFUN int XMLCALL
|
---|
177 | xmlTextWriterStartAttribute(xmlTextWriterPtr writer,
|
---|
178 | const xmlChar * name);
|
---|
179 | XMLPUBFUN int XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr
|
---|
180 | writer,
|
---|
181 | const xmlChar *
|
---|
182 | prefix,
|
---|
183 | const xmlChar *
|
---|
184 | name,
|
---|
185 | const xmlChar *
|
---|
186 | namespaceURI);
|
---|
187 | XMLPUBFUN int XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr
|
---|
188 | writer);
|
---|
189 |
|
---|
190 | /*
|
---|
191 | * Attributes conveniency functions
|
---|
192 | */
|
---|
193 | XMLPUBFUN int XMLCALL
|
---|
194 | xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer,
|
---|
195 | const xmlChar * name,
|
---|
196 | const char *format, ...);
|
---|
197 | XMLPUBFUN int XMLCALL
|
---|
198 | xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer,
|
---|
199 | const xmlChar * name,
|
---|
200 | const char *format,
|
---|
201 | va_list argptr);
|
---|
202 | XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr
|
---|
203 | writer,
|
---|
204 | const xmlChar * name,
|
---|
205 | const xmlChar *
|
---|
206 | content);
|
---|
207 | XMLPUBFUN int XMLCALL
|
---|
208 | xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer,
|
---|
209 | const xmlChar * prefix,
|
---|
210 | const xmlChar * name,
|
---|
211 | const xmlChar * namespaceURI,
|
---|
212 | const char *format, ...);
|
---|
213 | XMLPUBFUN int 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 int 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 int XMLCALL
|
---|
235 | xmlTextWriterStartPI(xmlTextWriterPtr writer,
|
---|
236 | const xmlChar * target);
|
---|
237 | XMLPUBFUN int XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer);
|
---|
238 |
|
---|
239 | /*
|
---|
240 | * PI conveniency functions
|
---|
241 | */
|
---|
242 | XMLPUBFUN int XMLCALL
|
---|
243 | xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer,
|
---|
244 | const xmlChar * target,
|
---|
245 | const char *format, ...);
|
---|
246 | XMLPUBFUN int XMLCALL
|
---|
247 | xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer,
|
---|
248 | const xmlChar * target,
|
---|
249 | const char *format, va_list argptr);
|
---|
250 | XMLPUBFUN int 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 int XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer);
|
---|
266 | XMLPUBFUN int XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer);
|
---|
267 |
|
---|
268 | /*
|
---|
269 | * CDATA conveniency functions
|
---|
270 | */
|
---|
271 | XMLPUBFUN int XMLCALL
|
---|
272 | xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer,
|
---|
273 | const char *format, ...);
|
---|
274 | XMLPUBFUN int XMLCALL
|
---|
275 | xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer,
|
---|
276 | const char *format, va_list argptr);
|
---|
277 | XMLPUBFUN int XMLCALL
|
---|
278 | xmlTextWriterWriteCDATA(xmlTextWriterPtr writer,
|
---|
279 | const xmlChar * content);
|
---|
280 |
|
---|
281 | /*
|
---|
282 | * DTD
|
---|
283 | */
|
---|
284 | XMLPUBFUN int XMLCALL
|
---|
285 | xmlTextWriterStartDTD(xmlTextWriterPtr writer,
|
---|
286 | const xmlChar * name,
|
---|
287 | const xmlChar * pubid,
|
---|
288 | const xmlChar * sysid);
|
---|
289 | XMLPUBFUN int XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer);
|
---|
290 |
|
---|
291 | /*
|
---|
292 | * DTD conveniency functions
|
---|
293 | */
|
---|
294 | XMLPUBFUN int XMLCALL
|
---|
295 | xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer,
|
---|
296 | const xmlChar * name,
|
---|
297 | const xmlChar * pubid,
|
---|
298 | const xmlChar * sysid,
|
---|
299 | const char *format, ...);
|
---|
300 | XMLPUBFUN int 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 int 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 int XMLCALL
|
---|
324 | xmlTextWriterStartDTDElement(xmlTextWriterPtr writer,
|
---|
325 | const xmlChar * name);
|
---|
326 | XMLPUBFUN int XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr
|
---|
327 | writer);
|
---|
328 |
|
---|
329 | /*
|
---|
330 | * DTD element definition conveniency functions
|
---|
331 | */
|
---|
332 | XMLPUBFUN int XMLCALL
|
---|
333 | xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer,
|
---|
334 | const xmlChar * name,
|
---|
335 | const char *format, ...);
|
---|
336 | XMLPUBFUN int XMLCALL
|
---|
337 | xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer,
|
---|
338 | const xmlChar * name,
|
---|
339 | const char *format,
|
---|
340 | va_list argptr);
|
---|
341 | XMLPUBFUN int 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 int XMLCALL
|
---|
352 | xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer,
|
---|
353 | const xmlChar * name);
|
---|
354 | XMLPUBFUN int XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr
|
---|
355 | writer);
|
---|
356 |
|
---|
357 | /*
|
---|
358 | * DTD attribute list definition conveniency functions
|
---|
359 | */
|
---|
360 | XMLPUBFUN int XMLCALL
|
---|
361 | xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer,
|
---|
362 | const xmlChar * name,
|
---|
363 | const char *format, ...);
|
---|
364 | XMLPUBFUN int XMLCALL
|
---|
365 | xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer,
|
---|
366 | const xmlChar * name,
|
---|
367 | const char *format,
|
---|
368 | va_list argptr);
|
---|
369 | XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr
|
---|
370 | writer,
|
---|
371 | const xmlChar *
|
---|
372 | name,
|
---|
373 | const xmlChar *
|
---|
374 | content);
|
---|
375 |
|
---|
376 | /*
|
---|
377 | * DTD entity definition
|
---|
378 | */
|
---|
379 | XMLPUBFUN int XMLCALL
|
---|
380 | xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer,
|
---|
381 | int pe, const xmlChar * name);
|
---|
382 | XMLPUBFUN int XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr
|
---|
383 | writer);
|
---|
384 |
|
---|
385 | /*
|
---|
386 | * DTD entity definition conveniency functions
|
---|
387 | */
|
---|
388 | XMLPUBFUN int XMLCALL
|
---|
389 | xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer,
|
---|
390 | int pe,
|
---|
391 | const xmlChar * name,
|
---|
392 | const char *format, ...);
|
---|
393 | XMLPUBFUN int XMLCALL
|
---|
394 | xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer,
|
---|
395 | int pe,
|
---|
396 | const xmlChar * name,
|
---|
397 | const char *format,
|
---|
398 | va_list argptr);
|
---|
399 | XMLPUBFUN int XMLCALL
|
---|
400 | xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer,
|
---|
401 | int pe,
|
---|
402 | const xmlChar * name,
|
---|
403 | const xmlChar * content);
|
---|
404 | XMLPUBFUN int XMLCALL
|
---|
405 | xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer,
|
---|
406 | int pe,
|
---|
407 | const xmlChar * name,
|
---|
408 | const xmlChar * pubid,
|
---|
409 | const xmlChar * sysid,
|
---|
410 | const xmlChar * ndataid);
|
---|
411 | XMLPUBFUN int XMLCALL
|
---|
412 | xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr
|
---|
413 | writer,
|
---|
414 | const xmlChar * pubid,
|
---|
415 | const xmlChar * sysid,
|
---|
416 | const xmlChar *
|
---|
417 | ndataid);
|
---|
418 | XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr
|
---|
419 | writer, int 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 int XMLCALL
|
---|
434 | xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer,
|
---|
435 | const xmlChar * name,
|
---|
436 | const xmlChar * pubid,
|
---|
437 | const xmlChar * sysid);
|
---|
438 |
|
---|
439 | /*
|
---|
440 | * Indentation
|
---|
441 | */
|
---|
442 | XMLPUBFUN int XMLCALL
|
---|
443 | xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent);
|
---|
444 | XMLPUBFUN int XMLCALL
|
---|
445 | xmlTextWriterSetIndentString(xmlTextWriterPtr writer,
|
---|
446 | const xmlChar * str);
|
---|
447 |
|
---|
448 | /*
|
---|
449 | * misc
|
---|
450 | */
|
---|
451 | XMLPUBFUN int XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer);
|
---|
452 |
|
---|
453 | #ifdef __cplusplus
|
---|
454 | }
|
---|
455 | #endif
|
---|
456 |
|
---|
457 | #endif /* LIBXML_WRITER_ENABLED */
|
---|
458 |
|
---|
459 | #endif /* __XML_XMLWRITER_H__ */
|
---|