def add_child(self, name, text=None, ns=True):
        if not ns or not self.__ns:
            log.debug('adding %s', name)
            element = self.__document.createElement(name)
        else:
            log.debug('adding %s ns "%s" %s', name, self.__ns, ns)
            if self.__prefix:
                element = self.__document.createElementNS(self.__ns, "%s:%s" % (self.__prefix, name))
            else:
                element = self.__document.createElementNS(self.__ns, name)
        # don't append null tags!
        if text is not None:
            if isinstance(text, unicode):
                element.appendChild(self.__document.createTextNode(text))
            else:
                element.appendChild(self.__document.createTextNode(str(text)))
        self._element.appendChild(element)
        return SimpleXMLElement(
                    elements=[element],
                    document=self.__document,
                    namespace=self.__ns,
                    prefix=self.__prefix,
                    namespaces_map=self.__namespaces_map)
Adding a child tag to a node
dataset/ETHPy150Open uwdata/termite-visualizations/web2py/gluon/contrib/pysimplesoap/simplexml.py/SimpleXMLElement.add_child