Exemplo n.º 1
0
 public void Test_Settup()
 {
     webRequest = new UfWebRequest();
     string url = "http://www.ufxtract.com/testsuite/hcard/hcard4.htm#uf";
     webRequest.Load(url, UfFormats.HCard());
     nodes = webRequest.Data.Nodes;
 }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = "http://www.xxxxxxxxxx.yyy/";

            UfWebRequest webRequest = null;
            UfErrors errors = new UfErrors();
            try
            {
            webRequest = new UfWebRequest();
            webRequest.Load(url, UfFormats.HCard());
            }
            catch (Exception ex)
            {
            if(webRequest.Urls.Count > 0)
            errors.Add(new UfError(ex.Message, url, webRequest.Urls[0].Status));
            else
            errors.Add(new UfError(ex.Message, url));
            }

            UfDataToJson dataConvertor = new UfDataToJson();
            Response.ContentType = "application/json";

            //Add reporting and errors
            dataConvertor.Urls = webRequest.Urls;
            dataConvertor.Errors = errors;

            Response.Write(dataConvertor.Convert(webRequest.Data, UfFormats.HCard()));
        }
 public void Test_Settup()
 {
     webRequest = new UfWebRequest();
     string url = "http://microformats.org/wiki/value-dt-test-YYYY-MM-DD--H-MM-SSpm-EE-NN-UUpm#uf";
     webRequest.Load(url, UfFormats.HCalendar());
     nodes = webRequest.Data.Nodes;
 }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = "http://www.glennjones.net/about/";

            UfWebRequest webRequest = new UfWebRequest();
            webRequest.Load(url, UfFormats.HCard());

            if (webRequest.Data.Nodes.Count > 0)
            {
                UfDataToJson dataConvertor = new UfDataToJson();
                Response.ContentType = "application/json";
                Response.Write(dataConvertor.Convert(webRequest.Data, UfFormats.HCard(), "myFuction"));
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = "http://ufxtract.com/testsuite/hcard/hcard1.htm#uf";

            UfWebRequest webRequest = new UfWebRequest();
            webRequest.Load(url, UfFormats.HCard());

            if (webRequest.Data.Nodes.Count > 0)
            {
                UfDataToJson dataConvertor = new UfDataToJson();
                Response.ContentType = "application/json";
                Response.Write(dataConvertor.Convert(webRequest.Data, UfFormats.HCard()));
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = "http://www.glennjones.net/about/";

            UfWebRequest webRequest = new UfWebRequest();
            webRequest.Load(url, UfFormats.HCard());

            if (webRequest.Data.Nodes.Count > 0)
            {
                UfDataToXml dataConvertor = new UfDataToXml();
                Response.ContentType = "text/xml";
                dataConvertor.Convert(webRequest.Data, Response.OutputStream);
            }
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = "http://www.glennjones.net/about/";

            UfWebRequest webRequest = new UfWebRequest();
            webRequest.Load(url, UfFormats.HCard());

            if (webRequest.Data.Nodes.Count > 0)
            {
                UfDataToMachineHtml dataConvertor = new UfDataToMachineHtml();
                Response.Write("<html><body>");
                Response.Write(dataConvertor.Convert(webRequest.Data, UfFormats.HCard()));
                Response.Write("</body></html>");
            }
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = "http://www.glennjones.net/about/";

            UfWebRequest webRequest = new UfWebRequest();
            ArrayList formatArray = new ArrayList();
            formatArray.Add(UfFormats.HCard());
            formatArray.Add(UfFormats.Xfn());
            formatArray.Add(UfFormats.Adr());
            formatArray.Add(UfFormats.License());

            webRequest.Load(url, formatArray);

            if (webRequest.Data.Nodes.Count > 0)
            {
                UfDataToJson dataConvertor = new UfDataToJson();
                Response.ContentType = "application/json";

                Response.Write(dataConvertor.Convert(webRequest.Data, formatArray));
            }
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = "http://www.glennjones.net/about/";

            UfWebRequest webRequest = new UfWebRequest();
            webRequest.Load(url, UfFormats.HCard());

            UfDataNode hcard = webRequest.Data.Nodes[0];
            string gn1 = hcard.DescendantValue("n/given-name");
            string gn2 = hcard.DescendantNode("n/given-name").Value;
            string ea = hcard.DescendantNode("adr[0]/extended-address[1]").Value;

            Response.Write("<div>" + gn1 + "</div>");
            Response.Write("<div>" + gn2 + "</div>");
            Response.Write("<div>" + ea + "</div>");

            Response.Write("<html><body>");
            foreach (UfDataNode node in webRequest.Data.Nodes)
            WriteNode(node, "");

            Response.Write("</body></html>");
        }
Exemplo n.º 10
0
        /// <summary>
        /// Parses a TestSuite to find all TestFixture
        /// </summary>
        /// <param name="url">The Url of a TestSuite</param>
        public void ParseTestSuite(string url)
        {
            // Get path relative to this project
            if (path == "")
            {
                String currentpath = Directory.GetCurrentDirectory();
                int startNum = currentpath.IndexOf("ufXtractUnitTestBuilder");
                if (startNum > 0)
                {
                    path = currentpath.Substring(0, startNum) + "ufXtractUnitTests\\";
                    Console.WriteLine("Writing unit text files to: " + path);
                }
                else
                {
                    Console.WriteLine("Problem finding path to write unit text files");
                }
            }

            number = 1;
            UfWebRequest webRequest = new UfWebRequest();
            webRequest.Load(url, UfFormats.TestSuite());
            foreach (UfDataNode node in webRequest.Data.Nodes)
            {
                FindTestSuite(node);
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Loads and parses a TestFixture
 /// </summary>
 /// <param name="url">The Url of the test fixture page</param>
 public void LoadTestFixture(string url)
 {
     UfWebRequest webRequest = new UfWebRequest();
     webRequest.Load(url, UfFormats.TestFixture());
     BuildTest(webRequest.Data, url);
 }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = "";
            string formatString = "";
            UfFormatDescriber formatDescriber = null; ;

            if (Request.QueryString["format"] != null)
            formatString = Request.QueryString["format"];

            if (Request.QueryString["url"] != null)
            url = Request.QueryString["url"];

            switch (formatString)
            {
            case "hcard":
            formatDescriber = UfFormats.HCard();
            break;
            case "hcalendar":
            formatDescriber = UfFormats.HCalendar();
            break;
            case "hreview":
            formatDescriber = UfFormats.HReview();
            break;
            case "hresume":
            formatDescriber = UfFormats.HResume();
            break;
            case "hatom":
            formatDescriber = UfFormats.HAtomItem();
            break;
            case "xfn":
            formatDescriber = UfFormats.Xfn();
            break;
            case "tag":
            formatDescriber = UfFormats.Tag();
            break;
            case "geo":
            formatDescriber = UfFormats.Geo();
            break;
            case "adr":
            formatDescriber = UfFormats.Adr();
            break;
            case "no-follow":
            formatDescriber = UfFormats.NoFollow();
            break;
            case "license":
            formatDescriber = UfFormats.License();
            break;
            case "votelinks":
            formatDescriber = UfFormats.VoteLinks();
            break;
            case "hcard-xfn":
            formatDescriber = UfFormats.HCardXFN();
            break;
            case "me":
            formatDescriber = UfFormats.Me();
            break;
            case "nextprevious":
            formatDescriber = UfFormats.NextPrevious();
            break;
            case "test-suite":
            formatDescriber = UfFormats.TestSuite();
            break;
            case "test-fixture":
            formatDescriber = UfFormats.TestFixture();
            break;

            }

            if (formatDescriber != null && url != "")
            {
            UfWebRequest webRequest = new UfWebRequest();
            webRequest.Load(url, formatDescriber);

            if (webRequest.Data.Nodes.Count > 0)
            {
            UfDataToJson dataConvertor = new UfDataToJson();
            Response.ContentType = "application/json";
            Response.Write(dataConvertor.Convert(webRequest.Data, formatDescriber));
            }
            }
        }