* htmlNodeDumpFileFormat: * @out: the FILE pointer * @doc: the document * @cur: the current node * @encoding: the document encoding * @format: should formatting spaces been added * * Dump an HTML node, recursive behaviour,children are printed too. * * TODO: if encoding == NULL try to save in the doc encoding * * returns: the number of byte written or -1 in case of failure. */
| 495 | * returns: the number of byte written or -1 in case of failure. |
| 496 | */ |
| 497 | int |
| 498 | htmlNodeDumpFileFormat(FILE *out, xmlDocPtr doc, |
| 499 | xmlNodePtr cur, const char *encoding, int format) { |
| 500 | xmlOutputBufferPtr buf; |
| 501 | xmlCharEncodingHandlerPtr handler; |
| 502 | int ret; |
| 503 | |
| 504 | xmlInitParser(); |
| 505 | |
| 506 | /* |
| 507 | * save the content to a temp buffer. |
| 508 | */ |
| 509 | handler = htmlFindOutputEncoder(encoding); |
| 510 | buf = xmlOutputBufferCreateFile(out, handler); |
| 511 | if (buf == NULL) { |
| 512 | xmlCharEncCloseFunc(handler); |
| 513 | return(0); |
| 514 | } |
| 515 | |
| 516 | htmlNodeDumpFormatOutput(buf, doc, cur, NULL, format); |
| 517 | |
| 518 | ret = xmlOutputBufferClose(buf); |
| 519 | return(ret); |
| 520 | } |
| 521 | |
| 522 | /** |
| 523 | * htmlNodeDumpFile: |
no test coverage detected