
A domain's metadata content has a namespace assigned to it but that value is removed when the XML is updated using the function "kimchi.xmlutils.xml_item_update" because it doesn't know about the namespaces. Register the namespace "kimchi" with the appropriate value when updating XML using the function "kimchi.xmlutils.xml_item_update". Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com> --- src/kimchi/xmlutils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/kimchi/xmlutils.py b/src/kimchi/xmlutils.py index 00a9d55..8b19a20 100644 --- a/src/kimchi/xmlutils.py +++ b/src/kimchi/xmlutils.py @@ -20,9 +20,10 @@ import libxml2 from lxml import objectify - from xml.etree import ElementTree +import kimchi.model + def xpath_get_text(xml, expr): doc = libxml2.parseDoc(xml) @@ -34,6 +35,9 @@ def xpath_get_text(xml, expr): def xml_item_update(xml, xpath, value): + ElementTree.register_namespace(kimchi.model.utils.KIMCHI_NAMESPACE, + kimchi.model.utils.KIMCHI_META_URL) + root = ElementTree.fromstring(xml) item = root.find(xpath) item.text = value -- 1.9.3