Next / Previous / Contents / Shipman's homepage

4.3. The Elt class: An element in progress

An instance of this class is returned by the S.start() method as a token of elements whose start tag has been written but whose end tag has not.

Elt(sox, tag)

The constructor requires two arguments: the containing Sox instance and the element name.

.end()

Calls the .end() method of the Sox instance. This is the normal method of termination.

.__enter__(self)

Does nothing; its existence is required by the Python context manager protocol.

.__exit__(self, exc_type, exc_value, traceback)

Required by the Python context manager protocol. Calls self.end().