xml: virXMLNamespace: add prefix

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@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Ján Tomko 2019-08-21 00:03:15 +02:00
parent 126ac61ea3
commit 2e2710caff

View File

@ -256,6 +256,7 @@ struct _virXMLNamespace {
virXMLNamespaceParse parse;
virXMLNamespaceFree free;
virXMLNamespaceFormat format;
const char *prefix;
virXMLNamespaceHref href;
};
typedef struct _virXMLNamespace virXMLNamespace;