* xmlShellCat: * @ctxt: the shell context * @arg: unused * @node: a node * @node2: unused * * Implements the XML shell function "cat" * dumps the serialization node content (XML or HTML). * * Returns 0 */
| 2395 | * Returns 0 |
| 2396 | */ |
| 2397 | int |
| 2398 | xmlShellCat(xmlShellCtxtPtr ctxt, char *arg ATTRIBUTE_UNUSED, |
| 2399 | xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED) |
| 2400 | { |
| 2401 | if (!ctxt) |
| 2402 | return (0); |
| 2403 | if (node == NULL) { |
| 2404 | fprintf(ctxt->output, "NULL\n"); |
| 2405 | return (0); |
| 2406 | } |
| 2407 | if (ctxt->doc->type == XML_HTML_DOCUMENT_NODE) { |
| 2408 | #ifdef LIBXML_HTML_ENABLED |
| 2409 | if (node->type == XML_HTML_DOCUMENT_NODE) |
| 2410 | htmlDocDump(ctxt->output, (htmlDocPtr) node); |
| 2411 | else |
| 2412 | htmlNodeDumpFile(ctxt->output, ctxt->doc, node); |
| 2413 | #else |
| 2414 | if (node->type == XML_DOCUMENT_NODE) |
| 2415 | xmlDocDump(ctxt->output, (xmlDocPtr) node); |
| 2416 | else |
| 2417 | xmlElemDump(ctxt->output, ctxt->doc, node); |
| 2418 | #endif /* LIBXML_HTML_ENABLED */ |
| 2419 | } else { |
| 2420 | if (node->type == XML_DOCUMENT_NODE) |
| 2421 | xmlDocDump(ctxt->output, (xmlDocPtr) node); |
| 2422 | else |
| 2423 | xmlElemDump(ctxt->output, ctxt->doc, node); |
| 2424 | } |
| 2425 | fprintf(ctxt->output, "\n"); |
| 2426 | return (0); |
| 2427 | } |
| 2428 | #endif /* LIBXML_OUTPUT_ENABLED */ |
| 2429 | |
| 2430 | /** |
no test coverage detected