Replace root element of this tree. This will discard the current contents of the tree and replace it with the given element. Use with care!
(self, element)
| 539 | return self._root |
| 540 | |
| 541 | def _setroot(self, element): |
| 542 | """Replace root element of this tree. |
| 543 | |
| 544 | This will discard the current contents of the tree and replace it |
| 545 | with the given element. Use with care! |
| 546 | |
| 547 | """ |
| 548 | if not iselement(element): |
| 549 | raise TypeError('expected an Element, not %s' |
| 550 | % type(element).__name__) |
| 551 | self._root = element |
| 552 | |
| 553 | def parse(self, source, parser=None): |
| 554 | """Load external XML document into element tree. |