private int DFS(HTMLNode now) { int pos = DFSDocument.Count; DFSDocument.Add(now.Info); int totchildren = 0; foreach(HTMLNode next in now.Children) totchildren += DFS(next); DFSDocument[pos]["TotChildren"] = totchildren; return totchildren; }
/// <summary> /// 分析源代码 /// </summary> public void AnalyseHTML() { try { Document = new HTMLNode("TAG",source); } catch (Exception ex) { Document = new HTMLNode("STRING",ex.ToString()); } }
private void DFS(int deep, HTMLNode now) { foreach (HTMLNode next in now.Children) DFS(deep + 1, next); }
public HTML() { source = ""; Document = new HTMLNode(); }