コード例 #1
0
ファイル: errors.aspx.cs プロジェクト: adampax/UfXtract
        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()));
        }
コード例 #2
0
ファイル: jsonp.aspx.cs プロジェクト: adampax/UfXtract
        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"));
            }
        }
コード例 #3
0
ファイル: urlfragment.aspx.cs プロジェクト: adampax/UfXtract
        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()));
            }
        }
コード例 #4
0
ファイル: html.aspx.cs プロジェクト: adampax/UfXtract
        protected void Page_Load(object sender, EventArgs e)
        {
            string html = "<div class=\"vcard\">";
            html += "<span class=\"fn\">Glenn Jones</span>";
            html += "</div>";

            UfParse parser = new UfParse();
            parser.Load(html, UfFormats.HCard());

            if (parser.Data.Nodes.Count > 0)
            {
                UfDataToJson dataConvertor = new UfDataToJson();
                Response.ContentType = "application/json";
                Response.Write(dataConvertor.Convert(parser.Data, UfFormats.HCard()));
            }
        }
コード例 #5
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));
            }
        }
コード例 #6
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));
            }
            }
        }