Recursively destroys the contents of this tree.
(self)
| 779 | return s |
| 780 | |
| 781 | def decompose(self): |
| 782 | """Recursively destroys the contents of this tree.""" |
| 783 | self.extract() |
| 784 | if len(self.contents) == 0: |
| 785 | return |
| 786 | current = self.contents[0] |
| 787 | while current is not None: |
| 788 | next = current.next |
| 789 | if isinstance(current, Tag): |
| 790 | del current.contents[:] |
| 791 | current.parent = None |
| 792 | current.previous = None |
| 793 | current.previousSibling = None |
| 794 | current.next = None |
| 795 | current.nextSibling = None |
| 796 | current = next |
| 797 | |
| 798 | def prettify(self, encoding=DEFAULT_OUTPUT_ENCODING): |
| 799 | return self.__str__(encoding, True) |