[collectd] [PATCH] curl_xml plugin: Allow XML element nodes to be selected for text

Dan Fandrich dan at coneharvesters.com
Wed Feb 6 21:44:03 CET 2013


This is a pretty basic use case, namely to select text within an XML
element, instead of just attribute values.
---
 src/curl_xml.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/curl_xml.c b/src/curl_xml.c
index 9573948..8a07881 100644
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
@@ -245,7 +245,8 @@ static xmlXPathObjectPtr cx_evaluate_xpath (xmlXPathContextPtr xpath_ctx, /* {{{
 
 static int cx_if_not_text_node (xmlNodePtr node) /* {{{ */
 {
-  if (node->type == XML_TEXT_NODE || node->type == XML_ATTRIBUTE_NODE)
+  if (node->type == XML_TEXT_NODE || node->type == XML_ATTRIBUTE_NODE ||
+      node->type == XML_ELEMENT_NODE)
     return (0);
 
   WARNING ("curl_xml plugin: "
-- 
1.7.10

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 308 bytes
Desc: not available
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20130206/9ee223f6/attachment.pgp>


More information about the collectd mailing list