Beispiel #1
0
        private void Parsing4XML()
        {
            Search myTemplate = new Search();

            myTemplate.company = myCompany;
            myTemplate.country = myCountry;
            myTemplate.year    = myYear;
            myTemplate.rate    = myRate;
            myTemplate.nato    = myNato;
            myTemplate.ga      = myGa;

            if (saxButton.Checked)
            {
                List <Search> res;
                IParse        parser = new SAX();
                res = parser.AnalyzeFile(myTemplate, path);
                Output(res);
            }
            else if (domButton.Checked)
            {
                IParse        parser = new DOM();
                List <Search> res;
                res = parser.AnalyzeFile(myTemplate, path);
                Output(res);
            }
            else if (linqButton.Checked)
            {
                IParse        parser = new LinqToXML();
                List <Search> res;
                res = parser.AnalyzeFile(myTemplate, path);
                Output(res);
            }
        }
Beispiel #2
0
        private void buildBox(ComboBox countryBox, ComboBox companyBox, ComboBox yearBox, ComboBox rateBox, ComboBox natoBox, ComboBox gaBox)
        {
            IParse        p       = new LinqToXML();
            List <Search> res     = p.AnalyzeFile(new Search(), path);
            List <string> country = new List <string>();
            List <string> company = new List <string>();
            List <string> year    = new List <string>();
            List <string> rate    = new List <string>();
            List <string> nato    = new List <string>();
            List <string> ga      = new List <string>();

            foreach (Search elem in res)
            {
                if (!country.Contains(elem.country))
                {
                    country.Add(elem.country);
                }
                if (!company.Contains(elem.company))
                {
                    company.Add(elem.company);
                }
                if (!year.Contains(elem.year))
                {
                    year.Add(elem.year);
                }
                if (!rate.Contains(elem.rate))
                {
                    rate.Add(elem.rate);
                }
                if (!nato.Contains(elem.nato))
                {
                    nato.Add(elem.nato);
                }
                if (!ga.Contains(elem.ga))
                {
                    ga.Add(elem.ga);
                }
            }


            country = country.OrderBy(x => x).ToList();
            company = company.OrderBy(x => x).ToList();
            year    = year.OrderBy(x => x).ToList();
            rate    = rate.OrderBy(x => x).ToList();
            nato    = nato.OrderBy(x => x).ToList();
            ga      = ga.OrderBy(x => x).ToList();

            countryBox.Items.AddRange(country.ToArray());
            companyBox.Items.AddRange(company.ToArray());
            yearBox.Items.AddRange(year.ToArray());
            rateBox.Items.AddRange(rate.ToArray());
            natoBox.Items.AddRange(nato.ToArray());
            gaBox.Items.AddRange(ga.ToArray());
        }