* node;b;
* node;c;
*/
+#include <common/defaults.hpp>
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/xpath.h>
-#include <libxml/xpathInternals.h>
-#include <common/defaults.hpp>
-
#if defined(LIBXML_XPATH_ENABLED)
static int opt_verbose;
LTTNG_ASSERT(nodes->nodeTab[i]);
if (nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) {
- fprintf(stderr, "ERR:%s\n",
- "This executable does not support xml namespacing\n");
+ fprintf(stderr,
+ "ERR:%s\n",
+ "This executable does not support xml namespacing\n");
ret = -1;
goto end;
} else if (nodes->nodeTab[i]->type == XML_ELEMENT_NODE) {
if (xmlChildElementCount(cur) == 0) {
if (xmlNodeIsText(cur->children)) {
- node_child_value_string = xmlNodeListGetString(doc,
- cur->children, 1);
+ node_child_value_string =
+ xmlNodeListGetString(doc, cur->children, 1);
if (node_exist) {
result = true;
} else if (opt_verbose) {
- fprintf(output, "%s;%s;\n", cur->name,
- node_child_value_string);
+ fprintf(output,
+ "%s;%s;\n",
+ cur->name,
+ node_child_value_string);
} else {
- fprintf(output, "%s\n",
- node_child_value_string);
+ fprintf(output, "%s\n", node_child_value_string);
}
xmlFree(node_child_value_string);
} else {
if (node_exist) {
result = true;
} else {
- fprintf(stderr, "ERR:%s\n",
- "Xpath expression return non-final xml element");
+ fprintf(stderr,
+ "ERR:%s\n",
+ "Xpath expression return non-final xml element");
ret = -1;
goto end;
}
result = true;
} else {
/* We don't want to print non-final element */
- fprintf(stderr, "ERR:%s\n",
- "Xpath expression return non-final xml element");
+ fprintf(stderr,
+ "ERR:%s\n",
+ "Xpath expression return non-final xml element");
ret = -1;
goto end;
}
return -1;
}
/* Do the main job */
- if (extract_xpath(argv[optind], (xmlChar *)argv[optind+1])) {
+ if (extract_xpath(argv[optind], (xmlChar *) argv[optind + 1])) {
return -1;
}