Exemplo n.º 1
0
        public ParsingManager()
        {
            //Dependency injection possible
            //additional parsers
            additionalParsersManager = new AdditionalParsersManager(new[] { new ScriptsParser() });

            //mainParser
            mainParserManager = new MainParserManager(new MainParser());

            //Post parsers
            postParsersManager = new PostParsersManager(new IPostParser[] { new ValuesPostParser(), new HtmlStackToHtmlDocumentParser() });
        }
        public ParsingResult Parse(string html, AdditionalParsersManager additionalParsersManager)
        {
            mainParser.Initialize(html);

            ParsingArguments parsingArguments = null;

            while (mainParser.ExecuteStep(parsingArguments, out parsingArguments))
            {
                additionalParsersManager.ExecuteAdditionalParsers(parsingArguments);
            }

            mainParser.Validate();
            return(mainParser.ParsingResult);
        }