html пакет agility удалить детей

Я испытываю затруднения при попытке удалить div с определенным идентификатором и его потомками с помощью пакета Agility HTML. Я уверен, что ям просто отсутствует опция конфигурации, но его пятница и яЯ изо всех сил.

Упрощенный HTML работает:


Это насколько я получил. Ошибка, выданная пакетом Agility, показывает, что он не может найти структуру div:


Вот'пока код (взят из Stackoverflow ....)

HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
        // There are various options, set as needed
        //htmlDoc.OptionFixNestedTags = true;

        // filePath is a path to a file containing the html
        htmlDoc.LoadHtml(Html);

        string output = string.Empty;

        // ParseErrors is an ArrayList containing any errors from the Load statement
        if (htmlDoc.ParseErrors != null && htmlDoc.ParseErrors.Count > 0)
        {
            // Handle any parse errors as required

        }
        else
        {

            if (htmlDoc.DocumentNode != null)
            {
               HtmlAgilityPack.HtmlNode bodyNode  = htmlDoc.DocumentNode.SelectSingleNode("//body");

                if (bodyNode != null)
                {
                    HtmlAgilityPack.HtmlNode functionBarNode = bodyNode.SelectSingleNode ("//div[@id='functionBar']");

                    bodyNode.RemoveChild(functionBarNode,false);

                    output = bodyNode.InnerHtml;
                }
            }
        }

Ответы на вопрос(3)

Ваш ответ на вопрос