* xmlShellSetContent: * @ctxt: the shell context * @value: the content as a string * @node: a node * @node2: unused * * Implements the XML shell function "dir" * dumps information about the node (namespace, attributes, content). * * Returns 0 */
| 2289 | * Returns 0 |
| 2290 | */ |
| 2291 | static int |
| 2292 | xmlShellSetContent(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, |
| 2293 | char *value, xmlNodePtr node, |
| 2294 | xmlNodePtr node2 ATTRIBUTE_UNUSED) |
| 2295 | { |
| 2296 | xmlNodePtr results; |
| 2297 | xmlParserErrors ret; |
| 2298 | |
| 2299 | if (!ctxt) |
| 2300 | return (0); |
| 2301 | if (node == NULL) { |
| 2302 | fprintf(ctxt->output, "NULL\n"); |
| 2303 | return (0); |
| 2304 | } |
| 2305 | if (value == NULL) { |
| 2306 | fprintf(ctxt->output, "NULL\n"); |
| 2307 | return (0); |
| 2308 | } |
| 2309 | |
| 2310 | ret = xmlParseInNodeContext(node, value, strlen(value), 0, &results); |
| 2311 | if (ret == XML_ERR_OK) { |
| 2312 | if (node->children != NULL) { |
| 2313 | xmlFreeNodeList(node->children); |
| 2314 | node->children = NULL; |
| 2315 | node->last = NULL; |
| 2316 | } |
| 2317 | xmlAddChildList(node, results); |
| 2318 | } else { |
| 2319 | fprintf(ctxt->output, "failed to parse content\n"); |
| 2320 | } |
| 2321 | return (0); |
| 2322 | } |
| 2323 | |
| 2324 | static void |
| 2325 | xmlShellPrintf(void *ctx, const char *msg, ...) { |
no test coverage detected