Ufxtract

Powerful, easy to use .Net microformats parser

Format selection

UfXtract currently supports 12 microformats and 5 POSH patterns. Each is defined in a format describer which has to be passed to the parser and sometimes the data convertor.

Currently supported formats

UfXtract supports the following microformats hCard, hCalendar, hReview, hResume, hAtom, XFN, rel-tag, geo, adr, rel-nofollow, rel-license, rel-directory, rel-home, rel-enclosure, rel-payement and votelinks. It also supports a handful of POSH patterns hCard-XFN, rel-me, rel-next/previous, test-suite and test-fixture. The direct support of rel-me, rel-next/previous was added to help people build social graph spiders.

Code example

using UfXtract;

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));
    }
}
Download Code MIT Open Source License About the UfXtract .Net library

Output formats

Formats

Inputs

.Net

Reporting and errors