virsh: Use proper helper for parsing XML in virshDumpXML

Use virXMLParseStringCtxt instead of virXMLParseString since the code
requires a XPath context anyways.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-09-23 14:42:18 +02:00
parent 402c31f3ac
commit f1cd95cc28

View File

@ -457,14 +457,11 @@ virshDumpXML(vshControl *ctl,
}
oldblanks = xmlKeepBlanksDefault(0);
doc = virXMLParseString(xml, url);
doc = virXMLParseStringCtxt(xml, url, &ctxt);
xmlKeepBlanksDefault(oldblanks);
if (!doc)
return false;
if (!(ctxt = virXMLXPathContextNew(doc)))
return false;
if ((nnodes = virXPathNodeSet(xpath, ctxt, &nodes)) < 0) {
return false;
}