[uf-discuss] UfXtract - more than one format at once
André Luís
andreluis.pt at gmail.com
Fri Jul 30 12:42:36 PDT 2010
hey Glenn,
On 30 July 2010 16:49, Glenn Jones <glenn.jones at madgex.com> wrote:
> Hi All
>
> André Luís wrote
>> One minor gripe, though... can't we ask for transformation for more than one format at once? Optimus does this. And it's kinda useful to avoid more than one requests per URI... :)
>
>
> OK I have added parsing more than one microformat to the UfXtract API. You have always been able to do this with the .Net library I just did not build it into API. The API format parameter can now takes either a single value or comma delimited list as the example below.
>
Awesome Glenn. Thanks! As usual, we ask and you deliver (still
remember the xfolk -> bookmarks.html story).
Even though I'm not a .net programmer myself this little fix will help
me spread the word among fellow .net dev's.
50ms beats the overheard of making one request per format! ;)
Cheers,
--
André Luís
http://id.andr3.net
> http://ufxtract.com/api/default.aspx?url=http%3A%2F%2Fwww.glennjones.net%2Fabout%2F&htmlfragment=&orginurl=http%3A%2F%2F&format=hcard%2Cxfn%2Chreview%2Chcalendar%2Chatom%2Chresume%2Cgeo%2Cadr%2Ctag%2Cnofollow%2Clicense%2Cdirectory%2Chome%2Cenclosure%2Cvotelinks&output=json&report=on
>
>
> The .Net library code looks like this:
>
>
> using UfXtract;
>
> 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());
> ...etc
>
> 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));
> }
>
>
> It's about twice as slow running all the microformats formats at once than just one at once. That said I am only talking about an extra 50ms.
>
>
> Glenn
>
>
> _______________________________________________
> microformats-discuss mailing list
> microformats-discuss at microformats.org
> http://microformats.org/mailman/listinfo/microformats-discuss
>
More information about the microformats-discuss
mailing list