MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlShellSetContent

Function xmlShellSetContent

ThirdParty/libxml2/vtklibxml2/debugXML.c:2291–2322  ·  view source on GitHub ↗

* 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 */

Source from the content-addressed store, hash-verified

2289 * Returns 0
2290 */
2291static int
2292xmlShellSetContent(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
2324static void
2325xmlShellPrintf(void *ctx, const char *msg, ...) {

Callers 1

xmlShellFunction · 0.85

Calls 4

fprintfFunction · 0.85
xmlParseInNodeContextFunction · 0.85
xmlFreeNodeListFunction · 0.85
xmlAddChildListFunction · 0.85

Tested by

no test coverage detected