[libvirt] [PATCH 09/21] xml: virXMLNamespace: add prefix

Ján Tomko jtomko at redhat.com
Tue Aug 20 23:15:31 UTC 2019


We have hardcoded the namespace prefix in various places:
1) the xmlns string stored in the 'href' function
2) the xmlXPathRegisterNs call in each parser
3) all the parsing and formatting code actually dealing
   with these elements

While eliminating the third one is probably a job for an
actual XML-aware formatter, let's store the prefix separately
here in the virXMLNamespace structure so that future patches
can get rid of the first two bullets.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/util/virxml.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/util/virxml.h b/src/util/virxml.h
index 5b209bb040..ea0c3d3ab3 100644
--- a/src/util/virxml.h
+++ b/src/util/virxml.h
@@ -256,6 +256,7 @@ struct _virXMLNamespace {
     virXMLNamespaceParse parse;
     virXMLNamespaceFree free;
     virXMLNamespaceFormat format;
+    const char *prefix;
     virXMLNamespaceHref href;
 };
 typedef struct _virXMLNamespace virXMLNamespace;
-- 
2.19.2




More information about the libvir-list mailing list