* xmlNewTextWriterPushParser: * @ctxt: xmlParserCtxtPtr to hold the new XML document tree * @compression: compress the output? * * Create a new xmlNewTextWriter structure with @ctxt as output * NOTE: the @ctxt context will be freed with the resulting writer * (if the call succeeds). * TODO: handle compression * * Returns the new xmlTextWriterPtr or NULL in case of error */
| 302 | * Returns the new xmlTextWriterPtr or NULL in case of error |
| 303 | */ |
| 304 | xmlTextWriterPtr |
| 305 | xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, |
| 306 | int compression ATTRIBUTE_UNUSED) |
| 307 | { |
| 308 | xmlTextWriterPtr ret; |
| 309 | xmlOutputBufferPtr out; |
| 310 | |
| 311 | if (ctxt == NULL) { |
| 312 | xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, |
| 313 | "xmlNewTextWriterPushParser : invalid context!\n"); |
| 314 | return NULL; |
| 315 | } |
| 316 | |
| 317 | out = xmlOutputBufferCreateIO(xmlTextWriterWriteDocCallback, |
| 318 | xmlTextWriterCloseDocCallback, |
| 319 | (void *) ctxt, NULL); |
| 320 | if (out == NULL) { |
| 321 | xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, |
| 322 | "xmlNewTextWriterPushParser : error at xmlOutputBufferCreateIO!\n"); |
| 323 | return NULL; |
| 324 | } |
| 325 | |
| 326 | ret = xmlNewTextWriter(out); |
| 327 | if (ret == NULL) { |
| 328 | xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, |
| 329 | "xmlNewTextWriterPushParser : error at xmlNewTextWriter!\n"); |
| 330 | xmlOutputBufferClose(out); |
| 331 | return NULL; |
| 332 | } |
| 333 | |
| 334 | ret->ctxt = ctxt; |
| 335 | |
| 336 | return ret; |
| 337 | } |
| 338 | |
| 339 | /** |
| 340 | * xmlNewTextWriterDoc: |
no test coverage detected