def __init__(self, doctype=None, strip_whitespace=True, namespace_prefixes=None, cache=True):
    'Initialize the XML serializer.\n        \n        :param doctype: a ``(name, pubid, sysid)`` tuple that represents the\n                        DOCTYPE declaration that should be included at the top\n                        of the generated output, or the name of a DOCTYPE as\n                        defined in `DocType.get`\n        :param strip_whitespace: whether extraneous whitespace should be\n                                 stripped from the output\n        :param cache: whether to cache the text output per event, which\n                      improves performance for repetitive markup\n        :note: Changed in 0.4.2: The  `doctype` parameter can now be a string.\n        :note: Changed in 0.6: The `cache` parameter was added\n        '
    self.filters = [EmptyTagFilter()]
    if strip_whitespace:
        self.filters.append(WhitespaceFilter(self._PRESERVE_SPACE))
    self.filters.append(NamespaceFlattener(prefixes=namespace_prefixes, cache=cache))
    if doctype:
        self.filters.append(DocTypeInserter(doctype))
    self.cache = cache
Initialize the XML serializer.

:param 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`
:param strip_whitespace: whether extraneous whitespace should be
                         stripped from the output
:param cache: whether to cache the text output per event, which
              improves performance for repetitive markup
:note: Changed in 0.4.2: The  `doctype` parameter can now be a string.
:note: Changed in 0.6: The `cache` parameter was added
def __init__(self, doctype=None, strip_whitespace=True, namespace_prefixes=None, cache=True):
    'Initialize the XML serializer.\n        \n        :param doctype: a ``(name, pubid, sysid)`` tuple that represents the\n                        DOCTYPE declaration that should be included at the top\n                        of the generated output, or the name of a DOCTYPE as\n                        defined in `DocType.get`\n        :param strip_whitespace: whether extraneous whitespace should be\n                                 stripped from the output\n        :param cache: whether to cache the text output per event, which\n                      improves performance for repetitive markup\n        :note: Changed in 0.4.2: The  `doctype` parameter can now be a string.\n        :note: Changed in 0.6: The `cache` parameter was added\n        '
    self.filters = [EmptyTagFilter()]
    if strip_whitespace:
        self.filters.append(WhitespaceFilter(self._PRESERVE_SPACE))
    self.filters.append(NamespaceFlattener(prefixes=namespace_prefixes, cache=cache))
    if doctype:
        self.filters.append(DocTypeInserter(doctype))
    self.cache = cache