Don't initialize SAX handler in htmlReadMemory The SAX handler is already initialized when creating the parser context.