public static string GetText(string text, RawlerBase rawler, RawlerBase parent) { Document doc = new Document(); doc.SetText(text); if (parent != null) { doc.SetParent(parent); } rawler.SetParent(doc); rawler.SetParent(); var last = rawler.GetDescendantRawler().Last(); rawler.Run(); return(last.Text); }
/// <summary> /// クローンを作る /// </summary> /// <param name="parent"></param> /// <returns></returns> public virtual RawlerBase Clone(RawlerBase parent) { RawlerBase clone = new RawlerBase(); // RawlerLib.ObjectLib.FildCopy(this, clone); clone.SetParent(parent); CloneEvent(clone); clone.Children.Clear(); foreach (var item in this.Children) { var child = item.Clone(clone); clone.AddChildren(child); } return(clone); }
/// <summary> /// PreTreeを通したあとのText /// </summary> /// <returns></returns> protected string GetText() { if (this.Parent != null) { if (preTree != null) { preTree.SetParent(); return(RawlerBase.GetText(this.Parent.Text, PreTree, this.Parent)); } else { return(this.Parent.Text); } } else { return(this.text); } }
/// <summary> /// 最初に挿入する。 /// </summary> /// <param name="rawler"></param> public void AddFirst(RawlerBase rawler) { children.Insert(0, rawler); rawler.SetParent(this); }
/// <summary> /// 子を追加する。 /// </summary> /// <param name="rawler"></param> public void AddChildren(RawlerBase rawler) { children.Add(rawler); rawler.SetParent(this); }