private void ConfigureParentParser(XMLParser *xmlParser)
 {
     if (namespaces)
     {
         LibExpat.XMLSetReturnNSTriplet(xmlParser, 1);
     }
     LibExpat.XMLSetUserData(xmlParser, (IntPtr)parserHandle);
     // this is a private handler that always needs to be set
     LibExpat.XMLSetExternalEntityRefHandler(xmlParser, externalEntityRefHandler);
 }
        public void Reset(string encoding, bool namespaces, bool nsTriplets)
        {
            CheckNotParsing();
            this.encoding = encoding;
            XMLParser *parser;

            if (this.namespaces != namespaces)
            {
                Reset();
                this.namespaces = namespaces;
                entityContext.Cleanup();
                entityContext.InitAsParent(encoding, namespaces);
                parser = entityContext.XmlParser;
                ConfigureParentParser(parser);
                ReInitializeHandlers(parser);
                LibExpat.XMLSetParamEntityParsing(parser, paramEntityParsing);
            }
            else
            {
                parser = ResetParser();
            }
            LibExpat.XMLSetReturnNSTriplet(parser, nsTriplets ? 1 : 0);
            isDone = false;
        }