def addhooks(self):
        hooks = self.createElement("Hooks")
        for state in sorted(self.session._hooks.keys()):
            for (filename, data) in self.session._hooks[state]:
                hook = self.createElement("Hook")
                hook.setAttribute("name", filename)
                hook.setAttribute("state", str(state))
                txt = self.createTextNode(data)
                hook.appendChild(txt)
                hooks.appendChild(hook)
        if hooks.hasChildNodes():
            self.meta.appendChild(hooks)
Add hook script XML elements to the metadata tag.
dataset/ETHPy150Open coreemu/core/daemon/core/misc/xmlwriter0.py/CoreDocumentWriter0.addhooks