On Mon, Mar 18, 2019 at 04:55:09PM +0100, Peter Krempa wrote:
Introduce a helper which parses XML into virStorageSource according
to
XPath queries passed in for the various bits. The new parser will allow
to unify the parsing of the various XML formats we use in different
parts without the need to do custom parsers.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/domain_conf.c | 94 ++++++++++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 12 +++++
src/libvirt_private.syms | 1 +
3 files changed, 107 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bf3ad45397..d2cc199ed5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9111,6 +9111,100 @@ virDomainStorageSourceParse(xmlNodePtr node,
}
+/**
+ * virDomainStorageSourceParseFull
+ * @typeXPath: XPath query string for the 'type' of virStorageSource
Does this need to be an XPath query as opposed to a simple attribute
queried by virXMLPropString?
All the callers pass either "string(@type)" "or string(./@type)"
+ * @formatXPath: XPath query for the image format (may be NULL if
caller wishes to parse it)
+ * @sourceXPath: XPath query for the <source> subelement
+ * @indexXPath: XPath query for 'id' in virStorageSource (may be NULL if
skipped)
+ * @allowMissing: if true no errors are reported if the above fields are missing
+ * @ctxt: XPath context
+ * @flags: XML parser flags
+ * @xmlopt: XML parser callbacks
+ *
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano