def __init__(self, formatter):
            # Keep tokens in a list:
            self._list = []
            self.formatter = formatter
            self.parser = xml.parsers.expat.ParserCreate(
                encoding=self.formatter.encoding_input
            )
            self.parser.specified_attributes = 1
            self.parser.buffer_text = True
            # Push tokens to buffer:
            for pattern in [
                "XmlDecl%s",
                "ElementDecl%s",
                "AttlistDecl%s",
                "EntityDecl%s",
                "StartElement%s",
                "EndElement%s",
                "ProcessingInstruction%s",
                "CharacterData%s",
                "Comment%s",
                "Default%s",
                "StartDoctypeDecl%s",
                "EndDoctypeDecl%s",
                "StartCdataSection%s",
                "EndCdataSection%s",
                "NotationDecl%s",
            ]:
                setattr(
                    self.parser, pattern % "Handler", self.xml_handler(pattern % "")
                )