[PATCH 06/15] util: xml: Introduce virXMLNodeGetSubelementList

Ján Tomko jtomko at redhat.com
Fri Jun 2 12:39:19 UTC 2023


On a Friday in 2023, Peter Krempa wrote:
>The new helper is similar to virXPathNodeSet list but for cases where we
>want to get subelements directly rather than using XPath.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/libvirt_private.syms |  1 +
> src/util/virxml.c        | 34 ++++++++++++++++++++++++++++++++++
> src/util/virxml.h        |  5 +++++
> 3 files changed, 40 insertions(+)
>
>diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
>index 27b8e111aa..436d5a0770 100644
>--- a/src/libvirt_private.syms
>+++ b/src/libvirt_private.syms
>@@ -3709,6 +3709,7 @@ virXMLFormatMetadata;
> virXMLNewNode;
> virXMLNodeContentString;
> virXMLNodeGetSubelement;
>+virXMLNodeGetSubelementList;
> virXMLNodeNameEqual;
> virXMLNodeSanitizeNamespaces;
> virXMLNodeToString;
>diff --git a/src/util/virxml.c b/src/util/virxml.c
>index e04455fcaa..0dae15a039 100644
>--- a/src/util/virxml.c
>+++ b/src/util/virxml.c
>@@ -899,6 +899,40 @@ virXMLNodeGetSubelement(xmlNodePtr node,
> }
>
>
>+/**
>+ * virXMLNodeGetSubelementList:
>+ * @node: node to get subelement of
>+ * @name: name of subelement to fetch (NULL to fetch all sub-elements)
>+ * @list: If non-NULL, filled with a list of pointers to the nodes. Caller is
>+ *        responsible for freeeing the list but not the members.

*freeing

>+ *
>+ * Find and return a sub-elements node of @node named @name in a list.
>+ * Returns the number of subelements with @name
>+ */

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20230602/ce6fe4b3/attachment.sig>


More information about the libvir-list mailing list