Microformats

A working Microformats extension to SimpleXML

Oliver Brown
— This upcoming video may not be available to view yet.

I’ve completed a basic version of a class that (sort of) extends SimpleXML. When I say sort of I mean it extends a wrapper class (ExtendXML) that inlcludes all the functionality of SimpleXML.

Download the following to try it out:

The object is created the same way as ExtendXML. After creating it you must also call:

// $mf is a MicroformatXML object 
$mf->mf_init();` 

This adds a new property, $mfHCards, which is an array of hCards. You can access the various hCard values as properties of these objects. As an example:

$mf = MicroformatXML::create\_from\_file($xmlFile);
$mf->mf\_init();
foreach ($mf->mfHCards as $hCard) {
    print $hCard->fn .'  ';
}

Please note this is a very early version that is undocumented and largely untested. It also doesn’t contain every hCard property.