[uf-discuss] hKit parsing library for PHP5
Scott Reynen
scott at randomchaos.com
Mon Jun 19 16:21:52 PDT 2006
On Jun 19, 2006, at 5:10 PM, Drew McLellan wrote:
> I poked around looking at stuff that's already out there, including
> Microformats Base, but I couldn't find anything that fitted the
> model I was after - namely chuck in a string or URL, and get out an
> array structure of, say, hCards.
>
> So in the principal of release early, release often, here's what
> I'm calling hKit for PHP5 version 0.1.
> http://allinthehead.com/code/hkit/hkit-v0.1.tgz
Neat. The first issue I see in a quick skim is that you seem to be
assuming values for date classes should be in the title attribute,
but deference to the title attribute is based on the <abbr> tag, not
the class name.
> It depends on SimpleXML in PHP5, and really needs either the PHP
> Tidy functions or tidy on the local system (a configurable
> setting), otherwise you're depending on the page being valid.
You could run the URL through a public Tidy proxy before parsing.
That makes it reliant on a server you can't control, but it also
makes it reliant on a service you don't need to control. Here's an
edited version demonstrating how this would work:
http://microformat.makedatamakesense.com/hkit.zip
Peace,
Scott
More information about the microformats-discuss
mailing list