It's equivalent of calling virXPahtString("string(.)", ctxt) but it
doesn't have to use the XPath resolving and parsing.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/libvirt_private.syms | 1 +
src/util/virxml.c | 16 ++++++++++++++++
src/util/virxml.h | 1 +
3 files changed, 18 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 7646998aef..f0e1e3eb6e 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2933,6 +2933,7 @@ virVHBAPathExists;
virXMLCheckIllegalChars;
virXMLChildElementCount;
virXMLExtractNamespaceXML;
+virXMLNodeContentString;
virXMLNodeNameEqual;
virXMLNodeSanitizeNamespaces;
virXMLNodeToString;
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 2904fc16c9..cf9122f261 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -541,6 +541,22 @@ virXMLPropStringLimit(xmlNodePtr node,
/**
+ * virXMLNodeContentString:
+ * @node: XML dom node pointer
+ *
+ * Convenience function to return copy of content of an XML node.
+ *
+ * Returns the content value as string or NULL in case of failure.
+ * The caller is responsible for freeing the returned buffer.
+ */
+char *
+virXMLNodeContentString(xmlNodePtr node)
+{
+ return (char *)xmlNodeGetContent(node);
+}
+
+
+/**
* virXPathBoolean:
* @xpath: the XPath string to evaluate
* @ctxt: an XPath context
diff --git a/src/util/virxml.h b/src/util/virxml.h
index 1ecc6b0a61..86baeb37a7 100644
--- a/src/util/virxml.h
+++ b/src/util/virxml.h
@@ -76,6 +76,7 @@ char * virXMLPropString(xmlNodePtr node,
char * virXMLPropStringLimit(xmlNodePtr node,
const char *name,
size_t maxlen);
+char * virXMLNodeContentString(xmlNodePtr node);
long virXMLChildElementCount(xmlNodePtr node);
/* Internal function; prefer the macros below. */
--
2.13.5