[uf-discuss] hKit parsing library for PHP5

Drew McLellan lists at allinthehead.com
Tue Jun 20 02:49:25 PDT 2006


On 20 Jun 2006, at 00:21, Scott Reynen wrote:

> 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.

Agreed. The implementation in its current state is over-simplistic.  
The biggest challenge I'm facing at the moment is working out a  
behavioral architecture that'll play nicely inside the 'profile'  
model. That's a problem I've not solved yet.


>> 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

Awesome - thanks for the patch. I had considered a proxy option, but  
dismissed it. Perhaps without good reason. I should look at that  
again, as it'd again lower the barrier for entry.

Thanks Scott.

drew.


More information about the microformats-discuss mailing list