[uf-discuss] Extended types (as in VCard, chapter 3.8)

Toby Inkster mail at tobyinkster.co.uk
Wed Dec 16 04:42:02 PST 2009


On Wed, 2009-12-16 at 11:34 +0100, Tobias Prinz wrote:
> 3. Not work with extended types at all. Which makes it unattractive to
> all systems that want to use hCard as a basic system to exchange data
> but want to extend it. It also is not in the spirit of VCard, I'd say.

In Swignition I implemented a handful of X-* properties, though this was
a list of additional properties recognised by the parser rather than
just allowing the page to specify arbitrary classes beginning with "x-".

> So I might be willing to use a work-around and (ab)use another element
> to store those values. I was just wondering which element would make
> the most sense? 
> It would need to be an element that has a type (to hold the "real"
> attribute name), that can appear more than once and that, ideally, has
> a very broad meaning. What would you use? 

<span class="category">Salary - €50000</span>
<span class="category">Shoe Size - 10.5</span>
<span class="category">Favourite Pizza - Pepperoni</span>

Then skim through categories doing something like this (Javascriptish
pseudo-code):

	$data = new Array();
	foreach ($vcard.category as $category)
	{
		if ($category.matches(/ - /))
		{
			($key, $val) = $category.split(/ - /);
			if (!$data[$key]) $data[$key] = new Array;
			$data[$key].push($val);
		}
	}

-- 
Toby A Inkster
<mailto:mail at tobyinkster.co.uk>
<http://tobyinkster.co.uk>



More information about the microformats-discuss mailing list