(self, root)
return root
Adds the URI namespace declaration to the root object if it is not present.
        This method is necessary because you cannot modify the nsmap attribute
        of an etree Element object.

        Keyword arguments:
        root -- the root etree Element object
Adds the URI namespace declaration to the root object if it is not present.
        This method is necessary because you cannot modify the nsmap attribute
        of an etree Element object.
Adds the URI namespace declaration to the root object if it is not present . This method is necessary because you cannot modify the nsmap attribute of an etree Element object .
def _add_namespaces(self, root):
        """Adds the URI namespace declaration to the root object if it is not present.
        This method is necessary because you cannot modify the nsmap attribute
        of an etree Element object.

        Keyword arguments:
        root -- the root etree Element object
        """
        uri_prefix = self._get_prefix_for_namespace(self.XML_NS_OBJ_URI, root.nsmap)

        if not uri_prefix:
            nsmap = root.nsmap
            nsmap[self.XML_NS_PREFIX_OBJ_URI] = self.XML_NS_OBJ_URI
            new_root = etree.Element(root.tag, nsmap=nsmap)
            new_root[:] = root[:]
            return new_root

        return root
def _add_namespaces ( self , root ) : uri_prefix = self . _get_prefix_for_namespace ( self . XML_NS_OBJ_URI , root . nsmap ) if not uri_prefix : nsmap = root . nsmap nsmap [ self . XML_NS_PREFIX_OBJ_URI ] = self . XML_NS_OBJ_URI new_root = etree . Element ( root . tag , nsmap = nsmap ) new_root [ : ] = root [ : ] return new_root return root