genshi.output.HTMLSerializer

Package genshi :: Module output :: Class HTMLSerializer |

# Class HTMLSerializer

       object --+
                |
    XMLSerializer --+
                    |
      XHTMLSerializer --+
                        |
                       HTMLSerializer

Produces HTML text from an event stream.

    >>> from genshi.builder import tag
    >>> elem = tag.div(tag.a(href='foo'), tag.br, tag.hr(noshade=True))
    >>> print(''.join(HTMLSerializer()(elem.generate())))
    <div><a href="foo"></a><br><hr noshade></div>

Instance Methods
__init__(self, doctype=None, strip_whitespace=True, cache=True) Initialize the HTML serializer. |
__call__(self, stream) |
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, doctype=None, strip_whitespace=True, cache=True) (Constructor) |
Initialize the HTML serializer. Parameters: `doctype` - a `(name, pubid, sysid)` tuple that represents the DOCTYPE declaration that should be included at the top of the generated output `strip_whitespace` - whether extraneous whitespace should be stripped from the output `cache` - whether to cache the text output per event, which improves performance for repetitive markup Overrides: object.__init__ Note: Changed in 0.6: The `cache` parameter was added

### __call__(self, stream) (Call operator) |
Overrides: XMLSerializer.__call__