///<summary> Constructor. </summary> public HtmlTagNode(HtmlTagNode aParentNode, HtmlTag aTag) : base() { isRoot = false; parentNode = aParentNode; tag = aTag; childTags = new List <HtmlTagNode>(); }
/// <summary> /// Parse Html /// </summary> public void Parse(TextReader reader) { previousNode = null; string input = reader.ReadToEnd(); while (input != "") { parseHtml(ref input); } }
/// <summary> Add a Non TextTag to Tag List </summary> internal void addTag(HtmlTag aTag) { // HtmlTagNode newNode = new HtmlTagNode( if (previousNode == null) { previousNode = tree; } while (!previousNode.CanAdd(aTag)) { previousNode = previousNode.Parent; } previousNode = previousNode.Add(aTag); }
static string printNode(Int32 level, HtmlTagNode node) { string spacing = " "; string retVal = ""; for (int i = 0; i < level; i++) { spacing += " "; } retVal += spacing + node.ToString() + '\r' + '\n'; foreach (HtmlTagNode subnode in node) { retVal += HtmlTagTree.printNode(level + 1, subnode); } return(retVal); }
public HtmlTagNode Add(HtmlTag aTag) { if (!CanAdd(aTag)) { throw new Exception("Cannot add here, check your coding."); } HtmlTagNode retVal = new HtmlTagNode(this, aTag); Items.Add(retVal); if (aTag.Name == '/' + tag.Name) { return(Parent); } else { return(retVal); } }