genshi.output.XHTMLSerializer

Package genshi :: Module output :: Class XHTMLSerializer |

# Class XHTMLSerializer

       object --+
                |
    XMLSerializer --+
                    |
                   XHTMLSerializer

Known Subclasses:
  - HTMLSerializer

Produces XHTML 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(XHTMLSerializer()(elem.generate()))
    <div><a href="foo"></a><br /><hr noshade="noshade" /></div>

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

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, doctype=None, strip_whitespace=True, namespace_prefixes=None, drop_xml_decl=True) (Constructor) |
Initialize the XML serializer. Parameters: `doctype` - a `(name, pubid, sysid)` tuple that represents the DOCTYPE declaration that should be included at the top of the generated output, or the name of a DOCTYPE as defined in DocType.get `strip_whitespace` - whether extraneous whitespace should be stripped from the output Overrides: object.__init__ (inherited documentation)

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