util: introduce virXMLNamespaceFormatNS

A function to automatically format the xmlns:<prefix>='<uri>'
attribute for per-driver namespaces.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Ján Tomko 2019-08-20 22:50:10 +02:00
parent 5802dec155
commit 7c3534e0a0
2 changed files with 12 additions and 0 deletions

View File

@ -1408,3 +1408,11 @@ virXPathContextNodeRestore(virXPathContextNodeSavePtr save)
save->ctxt->node = save->node;
}
void
virXMLNamespaceFormatNS(virBufferPtr buf,
virXMLNamespace const *ns)
{
virBufferAsprintf(buf, " xmlns:%s='%s'", ns->prefix, ns->href());
}

View File

@ -261,3 +261,7 @@ struct _virXMLNamespace {
};
typedef struct _virXMLNamespace virXMLNamespace;
typedef virXMLNamespace *virXMLNamespacePtr;
void
virXMLNamespaceFormatNS(virBufferPtr buf,
virXMLNamespace const *ns);