Пример #1
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>");
        }
Пример #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()));
        }
Пример #3
0
public void Test_Settup()
{
webRequest = new UfWebRequest();
string url = "http://www.ufxtract.com/testsuite/hcard/hcard7.htm#uf";
webRequest.Load(url, UfFormats.HCard());
nodes = webRequest.Data.Nodes;
}
Пример #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)
            {
                UfDataToXml dataConvertor = new UfDataToXml();
                Response.ContentType = "text/xml";
                dataConvertor.Convert(webRequest.Data, Response.OutputStream);
            }
        }
Пример #5
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"));
            }
        }
Пример #6
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()));
            }
        }
Пример #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)
            {
                UfDataToString dataConvertor = new UfDataToString();
                Response.Write("<pre>");
                Response.Write(dataConvertor.Convert(webRequest.Data));
                Response.Write("</pre>");
            }
        }
Пример #8
0
        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()));
            }
        }
        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));
            }
        }
        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));
                }
            }
        }