/// <summary> /// Make an exact copy of this object using the cloneable /// interface. /// </summary> /// <returns>A new object that is a clone of the specified /// object.</returns> public override Object Clone() { AttributeList rtn = new AttributeList(); for (int i = 0; i < m_list.Count; i++) { rtn.Add((Attribute)this[i].Clone()); } return(rtn); }
public AttributeList GetTag() { AttributeList tag = new AttributeList(); tag.Name = m_tag; foreach (Attribute x in List) { tag.Add((Attribute)x.Clone()); } return tag; }
public AttributeList GetTag() { AttributeList tag = new AttributeList(); tag.Name = m_tag; foreach (Attribute x in List) { tag.Add((Attribute)x.Clone()); } return(tag); }
static void Main(string[] args) { System.Console.Write("Enter a URL address:"); string url = System.Console.ReadLine(); System.Console.WriteLine("Scanning hyperlinks at: " + url); string page; if (url.StartsWith("http://", StringComparison.OrdinalIgnoreCase)) { page = GetPage(url); } else { page = ReadFile(url); } if (page == null) { System.Console.WriteLine("Can't process that type of file," + "please specify an HTML file URL." ); return; } ParseHTML parse = new ParseHTML(); parse.Source = page; while (!parse.Eof()) { char ch = parse.Parse(); if (ch == 0) { AttributeList tag = parse.GetTag(); if (tag["href"] != null) { System.Console.WriteLine("Found link: " + tag["href"].Value); } } } }
/// <summary> /// Make an exact copy of this object using the cloneable /// interface. /// </summary> /// <returns>A new object that is a clone of the specified /// object.</returns> public override Object Clone() { AttributeList rtn = new AttributeList(); for ( int i=0;i<m_list.Count;i++ ) rtn.Add( (Attribute)this[i].Clone() ); return rtn; }