def set_content(self, content):
        """Set textual content for the object/node.

        Verifies the node is allowed to contain content, and throws an
        exception if not.
        """
        if self.allows_content:
            self.content = content.strip()
        else:
            raise UNTLStructureException(
                'Element "%s" does not allow textual content' % (self.tag,)
            )