public static string CreateURL(string href, string title, string text)
 {
     ElementBuilder url = new ElementBuilder("url");
     url.AddAttribute("href", href);
     url.AddAttribute("title", title);
     url.AddContent(text);
     return url.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 src, string alt, string title)
 {
     ElementBuilder image = new ElementBuilder("img");
     image.AddAttribute("src", src);
     image.AddAttribute("alt", alt);
     image.AddAttribute("title", title);
     return image.ToString();
 }
Beispiel #4
0
        public static void Main(string[] args)
        {
            var li = new ElementBuilder("li");
            li.AddAttribute("class", "coolClass");
            li.AddContent("test");
            var ul = new ElementBuilder("ul");
            ul.AddContent(li * 2);
            Console.WriteLine(ul);

            Console.WriteLine(HtmlDispatcher.CreateImage("http://abv.bg/logo.jpg", "Logo", "ABV"));
            Console.WriteLine(HtmlDispatcher.CreateUrl("http://abv.bg/", "Click me", "Abv site"));
            Console.WriteLine(HtmlDispatcher.CreateInput("button", "Submit", "Click"));
        }
Beispiel #5
0
        public static void Main()
        {
            //ElementBuilder div = new ElementBuilder("div");
            //div.AddAttribute("id", "page");
            //div.AddAttribute("class", "big");
            //div.AddContent("<p>Hello</p>");
            //Console.WriteLine(div * 2);

            var li = new ElementBuilder("li");
            li.AddAttribute("class", "coolClass");
            li.AddContent("test");
            var ul = new ElementBuilder("ul");
            ul.AddContent(li * 2);
            Console.WriteLine(ul);

            Console.WriteLine(HTMLDispatcher.CreateImage("http://abv.bg/logo.jpg", "Logo", "ABV"));
            Console.WriteLine(HTMLDispatcher.CreateURL("http://abv.bg/", "Click me", "Abv site"));
            Console.WriteLine(HTMLDispatcher.CreateInput("button", "Submit", "Click"));
        }
Beispiel #6
0
        private static void Main()
        {
            ElementBuilder div = new ElementBuilder("div");

            div.AddAttribute("id", "page");
            div.AddAttribute("class", "big");
            div.AddContent("<p>Hello</p>");
            Console.WriteLine(div);

            // Well if you check my output with the example's output you will find a difference:
            // "<p>Hello</p>"(mine) and "<p>Hello></p>"(theirs) -it is the ">" right after "Hello".
            // I don't know if it is on purpose or not.
            // Console.WriteLine(div * 2);
            string image = HTMLDispatcher.CreateImage("gooogle.com", "alt", "Снимка");
            string url   = HTMLDispatcher.CreateURL("yahooo.bg", "Търсачка", "Имало едно време...");
            string input = HTMLDispatcher.CreateInput("string", "Входни данни", "Име: Пешо");

            Console.WriteLine(image);
            Console.WriteLine(url);
            Console.WriteLine(input);
        }