private void WriteElement(IHTMLElement elem) { if (elem.ID == "smile") { Console.WriteLine(elem.Attributes["src"].Value.ToString()); elem.Attributes["src"].Value = GetLocation() + @"\smile.gif"; } else if (elem.ID == "sad") { elem.Attributes["src"].Value = GetLocation() + @"\sad.gif"; } else if (elem.ID == "laugh") { elem.Attributes["src"].Value = GetLocation() + @"\laugh.gif"; } else if (elem.ID == "wave") { elem.Attributes["src"].Value = GetLocation() + @"\wave.gif"; } if (elem.Children.Count != 0) { IHTMLElementsCollection newParent = elem.Children; foreach (IHTMLElement smallChild in newParent) { WriteElement(smallChild); } } }
private void AddElements(IHTMLElement element, TreeNode parentNode) { IHTMLElementsCollection coll = element.Children; foreach (IHTMLElement elem in coll) { TreeNode tnode = null; tnode = parentNode.Nodes.Add(elem.Name); tnode.Tag = elem; AddElements(elem, tnode); } }
private string ReplaceImage(string OuterXML) { this.htmluiControl1.LoadFromString(OuterXML); IHTMLElement[] element = this.htmluiControl1.Document.GetElementsByName("body"); IHTMLElementsCollection collection = element[0].Children; foreach (IHTMLElement elem in collection) { WriteElement(elem); } return(this.htmluiControl1.Document.Document.OuterXml); }