Microformats
The labeling format microformats is used for semantically tagging HTML and XHTML documents. Well-known HTML attributes, like class, rel, and rev are extracted from the website code, enabling programs like web crawlers to read out semantic information. A typical use case would be to label contact information with the microformat hCard, which is integrated in the HTML code as class=’vcard’:
An example of common labeling for contact information in HTML:
01 | <div> |
02 | <div>first name last name</div> |
03 | <div>company</div> |
04 | <div>phone number</div> |
05 | <a href="http://website.com/">http://website.com/</a> |
06 | </div> |
Tagging contact information with the microformat hCard
01 | <div class="vcard"> |
02 | <div class="fn">first name last name</div> |
03 | <div class="org">company</div> |
04 | <div class="tel">phone number</div> |
05 | <a class="url" href="http://website.com/">http://website.com/</a> |
06 | </div> |
While the contact information in pure HTML markup is tagged as a div element, integrating the microformats hCard via the HTML attribute class=‘vcard’ enables distinct semantic annotations for specific bits of information—like names, organizations, or telephone numbers—to be incorporated. The advantage of this type of labeling is the easy application of known HTML attributes. Doing this limits the options of semantic annotations with microformats to a few predefined elements. Using class attributes can also lead to conflicts with CSS. An API for extracting data is also not supported by microformats.