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