util: introduce virXMLNodeNameEqual

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2017-08-14 14:31:52 +02:00
parent a045317680
commit 5bd8a1c5d8
3 changed files with 20 additions and 0 deletions

View File

@ -2931,6 +2931,7 @@ virVHBAPathExists;
virXMLCheckIllegalChars; virXMLCheckIllegalChars;
virXMLChildElementCount; virXMLChildElementCount;
virXMLExtractNamespaceXML; virXMLExtractNamespaceXML;
virXMLNodeNameEqual;
virXMLNodeSanitizeNamespaces; virXMLNodeSanitizeNamespaces;
virXMLNodeToString; virXMLNodeToString;
virXMLParseHelper; virXMLParseHelper;

View File

@ -950,6 +950,22 @@ virXMLNodeToString(xmlDocPtr doc,
return ret; return ret;
} }
/**
* virXMLNodeNameEqual:
* @node: xml Node pointer to check
* @name: name of the @node
*
* Compares the @node name with @name.
*/
bool
virXMLNodeNameEqual(xmlNodePtr node,
const char *name)
{
return xmlStrEqual(node->name, BAD_CAST name);
}
typedef int (*virXMLForeachCallback)(xmlNodePtr node, typedef int (*virXMLForeachCallback)(xmlNodePtr node,
void *opaque); void *opaque);

View File

@ -168,6 +168,9 @@ int virXMLSaveFile(const char *path,
char *virXMLNodeToString(xmlDocPtr doc, xmlNodePtr node); char *virXMLNodeToString(xmlDocPtr doc, xmlNodePtr node);
bool virXMLNodeNameEqual(xmlNodePtr node,
const char *name);
xmlNodePtr virXMLFindChildNodeByNs(xmlNodePtr root, xmlNodePtr virXMLFindChildNodeByNs(xmlNodePtr root,
const char *uri); const char *uri);