public void DeployRootNode(NodeGraph rootGraphNode)
        {
            var nodesWithItemSet = rootGraphNode.GetChildrenWithItemSet();

            XPathRoot = rootGraphNode.path;
            NodeName  = rootGraphNode.path.GetLastNodeNameFromXPath();

            HtmlNode htmlNode = rootGraphNode.FindHtmlNodeInstance(rootGraphNode.path);

            if (htmlNode != null)
            {
                RootNode = htmlNode;
                ID       = RootNode.Id;
                Class    = RootNode.GetAttributeValue("class", "");
            }
        }
Esempio n. 2
0
        public static HtmlNode FindHtmlNodeInstance(this NodeGraph graph, String XPath)
        {
            var allNodesWithItems = graph.GetChildrenWithItemSet(true);

            foreach (var entry in allNodesWithItems.Select(x => x.item))
            {
                if (entry.node != null)
                {
                    var result = entry.node.OwnerDocument.DocumentNode.SelectSingleNode(XPath);
                    if (result != null)
                    {
                        return(result);
                    }
                }
            }

            return(null);
        }