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