using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; namespace Rokojori { public class HtmlWalker: TreeWalker { private static HtmlWalker _instance = new HtmlWalker(); public static HtmlWalker instance => _instance; public override int NumChildren( HtmlNode node ) { var elementNode = node as HtmlElementNode; if ( elementNode != null ) { return elementNode.numChildren; } return 0; } public override HtmlNode ChildAt( HtmlNode node, int index ) { var elementNode = node as HtmlElementNode; if ( elementNode != null ) { return elementNode.GetChildAt( index ); } return null; } public override HtmlNode Parent( HtmlNode node ) { return node.parentNode; } } }