Eneboo - Documentación para desarrolladores
|
00001 00002 /* 00003 * Summary: text writing API for XML 00004 * Description: text writing API for XML 00005 * 00006 * Copy: See Copyright for the status of this software. 00007 * 00008 * Author: Alfred Mickautsch <alfred@mickautsch.de> 00009 */ 00010 00011 #ifndef __XML_XMLWRITER_H__ 00012 #define __XML_XMLWRITER_H__ 00013 00014 #include <libxml/xmlversion.h> 00015 00016 #ifdef LIBXML_WRITER_ENABLED 00017 00018 #include <stdarg.h> 00019 #include <libxml/xmlIO.h> 00020 #include <libxml/list.h> 00021 #include <libxml/xmlstring.h> 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 typedef struct _xmlTextWriter xmlTextWriter; 00028 typedef xmlTextWriter *xmlTextWriterPtr; 00029 00030 /* 00031 * Constructors & Destructor 00032 */ 00033 XMLPUBFUN xmlTextWriterPtr XMLCALL 00034 xmlNewTextWriter(xmlOutputBufferPtr out); 00035 XMLPUBFUN xmlTextWriterPtr XMLCALL 00036 xmlNewTextWriterFilename(const char *uri, int compression); 00037 XMLPUBFUN xmlTextWriterPtr XMLCALL 00038 xmlNewTextWriterMemory(xmlBufferPtr buf, int compression); 00039 XMLPUBFUN xmlTextWriterPtr XMLCALL 00040 xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression); 00041 XMLPUBFUN xmlTextWriterPtr XMLCALL 00042 xmlNewTextWriterDoc(xmlDocPtr * doc, int compression); 00043 XMLPUBFUN xmlTextWriterPtr XMLCALL 00044 xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, 00045 int compression); 00046 XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer); 00047 00048 /* 00049 * Functions 00050 */ 00051 00052 00053 /* 00054 * Document 00055 */ 00056 XMLPUBFUN int XMLCALL 00057 xmlTextWriterStartDocument(xmlTextWriterPtr writer, 00058 const char *version, 00059 const char *encoding, 00060 const char *standalone); 00061 XMLPUBFUN int XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr 00062 writer); 00063 00064 /* 00065 * Comments 00066 */ 00067 XMLPUBFUN int XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr 00068 writer); 00069 XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer); 00070 XMLPUBFUN int XMLCALL 00071 xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer, 00072 const char *format, ...) 00073 LIBXML_ATTR_FORMAT(2,3); 00074 XMLPUBFUN int XMLCALL 00075 xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, 00076 const char *format, 00077 va_list argptr) 00078 LIBXML_ATTR_FORMAT(2,0); 00079 XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr 00080 writer, 00081 const xmlChar * 00082 content); 00083 00084 /* 00085 * Elements 00086 */ 00087 XMLPUBFUN int XMLCALL 00088 xmlTextWriterStartElement(xmlTextWriterPtr writer, 00089 const xmlChar * name); 00090 XMLPUBFUN int XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr 00091 writer, 00092 const xmlChar * 00093 prefix, 00094 const xmlChar * name, 00095 const xmlChar * 00096 namespaceURI); 00097 XMLPUBFUN int XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer); 00098 XMLPUBFUN int XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr 00099 writer); 00100 00101 /* 00102 * Elements conveniency functions 00103 */ 00104 XMLPUBFUN int XMLCALL 00105 xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer, 00106 const xmlChar * name, 00107 const char *format, ...) 00108 LIBXML_ATTR_FORMAT(3,4); 00109 XMLPUBFUN int XMLCALL 00110 xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer, 00111 const xmlChar * name, 00112 const char *format, 00113 va_list argptr) 00114 LIBXML_ATTR_FORMAT(3,0); 00115 XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr 00116 writer, 00117 const xmlChar * name, 00118 const xmlChar * 00119 content); 00120 XMLPUBFUN int XMLCALL 00121 xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer, 00122 const xmlChar * prefix, 00123 const xmlChar * name, 00124 const xmlChar * namespaceURI, 00125 const char *format, ...) 00126 LIBXML_ATTR_FORMAT(5,6); 00127 XMLPUBFUN int XMLCALL 00128 xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer, 00129 const xmlChar * prefix, 00130 const xmlChar * name, 00131 const xmlChar * namespaceURI, 00132 const char *format, 00133 va_list argptr) 00134 LIBXML_ATTR_FORMAT(5,0); 00135 XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr 00136 writer, 00137 const xmlChar * 00138 prefix, 00139 const xmlChar * name, 00140 const xmlChar * 00141 namespaceURI, 00142 const xmlChar * 00143 content); 00144 00145 /* 00146 * Text 00147 */ 00148 XMLPUBFUN int XMLCALL 00149 xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, 00150 const char *format, ...) 00151 LIBXML_ATTR_FORMAT(2,3); 00152 XMLPUBFUN int XMLCALL 00153 xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, 00154 const char *format, va_list argptr) 00155 LIBXML_ATTR_FORMAT(2,0); 00156 XMLPUBFUN int XMLCALL 00157 xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, 00158 const xmlChar * content, int len); 00159 XMLPUBFUN int XMLCALL 00160 xmlTextWriterWriteRaw(xmlTextWriterPtr writer, 00161 const xmlChar * content); 00162 XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr 00163 writer, 00164 const char 00165 *format, ...) 00166 LIBXML_ATTR_FORMAT(2,3); 00167 XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr 00168 writer, 00169 const char 00170 *format, 00171 va_list argptr) 00172 LIBXML_ATTR_FORMAT(2,0); 00173 XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer, 00174 const xmlChar * 00175 content); 00176 XMLPUBFUN int XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer, 00177 const char *data, 00178 int start, int len); 00179 XMLPUBFUN int XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, 00180 const char *data, 00181 int start, int len); 00182 00183 /* 00184 * Attributes 00185 */ 00186 XMLPUBFUN int XMLCALL 00187 xmlTextWriterStartAttribute(xmlTextWriterPtr writer, 00188 const xmlChar * name); 00189 XMLPUBFUN int XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr 00190 writer, 00191 const xmlChar * 00192 prefix, 00193 const xmlChar * 00194 name, 00195 const xmlChar * 00196 namespaceURI); 00197 XMLPUBFUN int XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr 00198 writer); 00199 00200 /* 00201 * Attributes conveniency functions 00202 */ 00203 XMLPUBFUN int XMLCALL 00204 xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer, 00205 const xmlChar * name, 00206 const char *format, ...) 00207 LIBXML_ATTR_FORMAT(3,4); 00208 XMLPUBFUN int XMLCALL 00209 xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer, 00210 const xmlChar * name, 00211 const char *format, 00212 va_list argptr) 00213 LIBXML_ATTR_FORMAT(3,0); 00214 XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr 00215 writer, 00216 const xmlChar * name, 00217 const xmlChar * 00218 content); 00219 XMLPUBFUN int XMLCALL 00220 xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer, 00221 const xmlChar * prefix, 00222 const xmlChar * name, 00223 const xmlChar * namespaceURI, 00224 const char *format, ...) 00225 LIBXML_ATTR_FORMAT(5,6); 00226 XMLPUBFUN int XMLCALL 00227 xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer, 00228 const xmlChar * prefix, 00229 const xmlChar * name, 00230 const xmlChar * namespaceURI, 00231 const char *format, 00232 va_list argptr) 00233 LIBXML_ATTR_FORMAT(5,0); 00234 XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr 00235 writer, 00236 const xmlChar * 00237 prefix, 00238 const xmlChar * 00239 name, 00240 const xmlChar * 00241 namespaceURI, 00242 const xmlChar * 00243 content); 00244 00245 /* 00246 * PI's 00247 */ 00248 XMLPUBFUN int XMLCALL 00249 xmlTextWriterStartPI(xmlTextWriterPtr writer, 00250 const xmlChar * target); 00251 XMLPUBFUN int XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer); 00252 00253 /* 00254 * PI conveniency functions 00255 */ 00256 XMLPUBFUN int XMLCALL 00257 xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, 00258 const xmlChar * target, 00259 const char *format, ...) 00260 LIBXML_ATTR_FORMAT(3,4); 00261 XMLPUBFUN int XMLCALL 00262 xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer, 00263 const xmlChar * target, 00264 const char *format, va_list argptr) 00265 LIBXML_ATTR_FORMAT(3,0); 00266 XMLPUBFUN int XMLCALL 00267 xmlTextWriterWritePI(xmlTextWriterPtr writer, 00268 const xmlChar * target, 00269 const xmlChar * content); 00270 00276 #define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI 00277 00278 /* 00279 * CDATA 00280 */ 00281 XMLPUBFUN int XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer); 00282 XMLPUBFUN int XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer); 00283 00284 /* 00285 * CDATA conveniency functions 00286 */ 00287 XMLPUBFUN int XMLCALL 00288 xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, 00289 const char *format, ...) 00290 LIBXML_ATTR_FORMAT(2,3); 00291 XMLPUBFUN int XMLCALL 00292 xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, 00293 const char *format, va_list argptr) 00294 LIBXML_ATTR_FORMAT(2,0); 00295 XMLPUBFUN int XMLCALL 00296 xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, 00297 const xmlChar * content); 00298 00299 /* 00300 * DTD 00301 */ 00302 XMLPUBFUN int XMLCALL 00303 xmlTextWriterStartDTD(xmlTextWriterPtr writer, 00304 const xmlChar * name, 00305 const xmlChar * pubid, 00306 const xmlChar * sysid); 00307 XMLPUBFUN int XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer); 00308 00309 /* 00310 * DTD conveniency functions 00311 */ 00312 XMLPUBFUN int XMLCALL 00313 xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer, 00314 const xmlChar * name, 00315 const xmlChar * pubid, 00316 const xmlChar * sysid, 00317 const char *format, ...) 00318 LIBXML_ATTR_FORMAT(5,6); 00319 XMLPUBFUN int XMLCALL 00320 xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer, 00321 const xmlChar * name, 00322 const xmlChar * pubid, 00323 const xmlChar * sysid, 00324 const char *format, va_list argptr) 00325 LIBXML_ATTR_FORMAT(5,0); 00326 XMLPUBFUN int XMLCALL 00327 xmlTextWriterWriteDTD(xmlTextWriterPtr writer, 00328 const xmlChar * name, 00329 const xmlChar * pubid, 00330 const xmlChar * sysid, 00331 const xmlChar * subset); 00332 00338 #define xmlTextWriterWriteDocType xmlTextWriterWriteDTD 00339 00340 /* 00341 * DTD element definition 00342 */ 00343 XMLPUBFUN int XMLCALL 00344 xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, 00345 const xmlChar * name); 00346 XMLPUBFUN int XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr 00347 writer); 00348 00349 /* 00350 * DTD element definition conveniency functions 00351 */ 00352 XMLPUBFUN int XMLCALL 00353 xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer, 00354 const xmlChar * name, 00355 const char *format, ...) 00356 LIBXML_ATTR_FORMAT(3,4); 00357 XMLPUBFUN int XMLCALL 00358 xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer, 00359 const xmlChar * name, 00360 const char *format, 00361 va_list argptr) 00362 LIBXML_ATTR_FORMAT(3,0); 00363 XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr 00364 writer, 00365 const xmlChar * 00366 name, 00367 const xmlChar * 00368 content); 00369 00370 /* 00371 * DTD attribute list definition 00372 */ 00373 XMLPUBFUN int XMLCALL 00374 xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, 00375 const xmlChar * name); 00376 XMLPUBFUN int XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr 00377 writer); 00378 00379 /* 00380 * DTD attribute list definition conveniency functions 00381 */ 00382 XMLPUBFUN int XMLCALL 00383 xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer, 00384 const xmlChar * name, 00385 const char *format, ...) 00386 LIBXML_ATTR_FORMAT(3,4); 00387 XMLPUBFUN int XMLCALL 00388 xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer, 00389 const xmlChar * name, 00390 const char *format, 00391 va_list argptr) 00392 LIBXML_ATTR_FORMAT(3,0); 00393 XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr 00394 writer, 00395 const xmlChar * 00396 name, 00397 const xmlChar * 00398 content); 00399 00400 /* 00401 * DTD entity definition 00402 */ 00403 XMLPUBFUN int XMLCALL 00404 xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer, 00405 int pe, const xmlChar * name); 00406 XMLPUBFUN int XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr 00407 writer); 00408 00409 /* 00410 * DTD entity definition conveniency functions 00411 */ 00412 XMLPUBFUN int XMLCALL 00413 xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer, 00414 int pe, 00415 const xmlChar * name, 00416 const char *format, ...) 00417 LIBXML_ATTR_FORMAT(4,5); 00418 XMLPUBFUN int XMLCALL 00419 xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer, 00420 int pe, 00421 const xmlChar * name, 00422 const char *format, 00423 va_list argptr) 00424 LIBXML_ATTR_FORMAT(4,0); 00425 XMLPUBFUN int XMLCALL 00426 xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer, 00427 int pe, 00428 const xmlChar * name, 00429 const xmlChar * content); 00430 XMLPUBFUN int XMLCALL 00431 xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer, 00432 int pe, 00433 const xmlChar * name, 00434 const xmlChar * pubid, 00435 const xmlChar * sysid, 00436 const xmlChar * ndataid); 00437 XMLPUBFUN int XMLCALL 00438 xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr 00439 writer, 00440 const xmlChar * pubid, 00441 const xmlChar * sysid, 00442 const xmlChar * 00443 ndataid); 00444 XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr 00445 writer, int pe, 00446 const xmlChar * name, 00447 const xmlChar * 00448 pubid, 00449 const xmlChar * 00450 sysid, 00451 const xmlChar * 00452 ndataid, 00453 const xmlChar * 00454 content); 00455 00456 /* 00457 * DTD notation definition 00458 */ 00459 XMLPUBFUN int XMLCALL 00460 xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer, 00461 const xmlChar * name, 00462 const xmlChar * pubid, 00463 const xmlChar * sysid); 00464 00465 /* 00466 * Indentation 00467 */ 00468 XMLPUBFUN int XMLCALL 00469 xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent); 00470 XMLPUBFUN int XMLCALL 00471 xmlTextWriterSetIndentString(xmlTextWriterPtr writer, 00472 const xmlChar * str); 00473 00474 /* 00475 * misc 00476 */ 00477 XMLPUBFUN int XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer); 00478 00479 #ifdef __cplusplus 00480 } 00481 #endif 00482 00483 #endif /* LIBXML_WRITER_ENABLED */ 00484 00485 #endif /* __XML_XMLWRITER_H__ */