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

Jiri Denemark jdenemar at redhat.com
Wed Aug 21 06:49:35 UTC 2019


On Wed, Aug 21, 2019 at 01:15:31 +0200, Ján Tomko wrote:
> 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;

Reviewed-by: Jiri Denemark <jdenemar at redhat.com>




More information about the libvir-list mailing list