Close and return current Element. *tag* is the element name.
(self, tag)
| 1479 | return elem |
| 1480 | |
| 1481 | def end(self, tag): |
| 1482 | """Close and return current Element. |
| 1483 | |
| 1484 | *tag* is the element name. |
| 1485 | |
| 1486 | """ |
| 1487 | self._flush() |
| 1488 | self._last = self._elem.pop() |
| 1489 | assert self._last.tag == tag,\ |
| 1490 | "end tag mismatch (expected %s, got %s)" % ( |
| 1491 | self._last.tag, tag) |
| 1492 | self._tail = 1 |
| 1493 | return self._last |
| 1494 | |
| 1495 | def comment(self, text): |
| 1496 | """Create a comment using the comment_factory. |