Esempio n. 1
0
        // replaces the bold

        // takes the string and prepares the list of the elements
        static List <IElement> Parser2(IHtmlDocument document)
        {
            // use a main StringBuilder and add and remove string to it.
            var ElementsForModification = new List <IElement>()
            {
                document.GetElementById("__DESCRIPTION__"),
                document.GetElementById("__MANUFACTURER__")
            };

            void add(IHtmlCollection <IElement> elements)
            {
                foreach (var element in elements)
                {
                    ElementsForModification.Add(element);
                }
            }

            add(document.GetElementsByName("__FEATURES__"));
            add(document.GetElementsByName("__DESCRIPTION__"));
            add(document.GetElementsByName("__MANUFACTURER__"));

            return(ElementsForModification);
            // pass the elements list to prepare for modification
        }
Esempio n. 2
0
        private static List <IElement> ListElementForModification(IHtmlDocument document)
        {
            // use a main StringBuilder and add and remove string to it.
            var ElementsForModification = new List <IElement>()
            {
                document.GetElementById("__DESCRIPTION__"),
                document.GetElementById("__MANUFACTURER__")
            };

            var tags = new String[] { "__DESCRIPTION__", "__FEATURES__", "__MANUFACTURER__" };

            foreach (var tag in tags)
            {
                ElementsForModification.AddRange(document.GetElementsByName(tag).AsEnumerable());
            }
            ElementsForModification.RemoveAll(element => element == null);
            return(ElementsForModification);
        }