なんだか三連続でmicoroformats関連エントリーです。「PHP Classes」でたまたま見つけたmicroformatsのパーサ。
ずっと簡単なmicroformatsのパーサを試してみたかったので、「お!」と思って使ってみたのだが色々と問題が…。
とりあえず以下のように使える。簡単だー。と思っていたらその下の必要なものを見て欲しい。
include ('lib/MicroFormatParser.php'); $html = file('testpage.html'); $html = join("\n", $html); $mfParser = new MicroFormatParser(); $mfParser->parserSetup (array ( 'hcard' => true, 'hreview' => true, 'hcalendar' => true, 'reltag' => true, )); $mf = $mfParser->parseSource($html); echo '<pre>'; $mf->each(' echo "<h1>".get_class($value)."</h1>"; var_export($value); echo "<hr />"; ');
いやーーー。PHP5.xで動かないのかーーー。すんごく残念!