public static string CreateUrl(string url, string title, string text) { ElementBuilder link = new ElementBuilder("a"); link.AddAttribute("href", url); link.AddAttribute("title", title); link.AddContent(text); return link.ToString(); }
public static string CreateInput(string type, string name, string value) { ElementBuilder input = new ElementBuilder("input"); input.AddAttribute("type", type); input.AddAttribute("name", name); input.AddAttribute("value", value); return input.ToString(); }
public static string CreateImage(string imgSource, string alt, string title) { ElementBuilder image = new ElementBuilder("img"); image.AddAttribute("src", imgSource); image.AddAttribute("alt", alt); image.AddAttribute("title", title); return image.ToString(); }
public static string CreateURL(string url2, string title, string text) { ElementBuilder url = new ElementBuilder("a"); url.AddAtributes("href", url2); url.AddAtributes("title", title); url.AddContent(text); return url.ToString(); }
static void Main(string[] args) { ElementBuilder div = new ElementBuilder("div"); div.AddAtributes("id", "page"); div.AddAtributes("class", "big"); div.AddContent("<p>Hello</p>"); Console.WriteLine(div * 2); Console.WriteLine(HTMLDispatcher.CreateImage("http://image.jpg", "this is a great image", "Mona Lisa")); }
static void Main(string[] args) { try { var div = new ElementBuilder("div"); div.AddAttribute("id", "page"); div.AddAttribute("class", "big"); div.AddContent("<p>Hello</p>"); Console.WriteLine(div * 3); Console.WriteLine(HTMLDispatcher.CreateImage("http://vicove.com/jokepics/thumb_sredna_51453.jpg", "bus", "bus.rar")); Console.WriteLine(HTMLDispatcher.CreateUrl("http://vicove.com/", "Click me for more fun", "vicove.com")); Console.WriteLine(HTMLDispatcher.CreateInput("textform", "email", "*****@*****.**")); } catch (ArgumentOutOfRangeException e) { Console.WriteLine(e.Message); } catch (ArgumentException e) { Console.WriteLine(e.Message); } }