mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
util: introduce virXMLNodeContentString
It's equivalent of calling virXPathString("string(.)", ctxt) but it doesn't have to use the XPath resolving and parsing. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
827cf58d50
commit
561726cd7f
@ -2954,6 +2954,7 @@ virVHBAPathExists;
|
||||
virXMLCheckIllegalChars;
|
||||
virXMLChildElementCount;
|
||||
virXMLExtractNamespaceXML;
|
||||
virXMLNodeContentString;
|
||||
virXMLNodeNameEqual;
|
||||
virXMLNodeSanitizeNamespaces;
|
||||
virXMLNodeToString;
|
||||
|
@ -540,6 +540,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
|
||||
|
@ -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. */
|
||||
|
Loading…
Reference in New Issue
Block a user