Mostrando entradas con la etiqueta pruena. Mostrar todas las entradas
Mostrando entradas con la etiqueta pruena. Mostrar todas las entradas

of the semantics of

f that was all microformats did, then it wouldn't be very interesting. Instead, microformats make use of the semantics of existing HTML elements to explain where the encoded data can be found. In this example everything is a , but it doesn't have to be. This is what makes extracting data from the HTML slightly more difficult for parsers, but makes it easier for publisher. Microformats do not force publishers to change their current HTML structure or publishing behavior. At the end of the day, there will be factors of 10 more people writing HTML than writing parsers, so why not make it as easy as possible for the publishers?

It bugs me when I look at the previous XML example and see "Brian Suda" encoded twice, once for FN then repeated again for N. With HTML this isn't a problem, we can combine those two XML elements using space-separated values in the class attribute. It is a little know fact that the class, rel, and rev attributes in HTML can actually take a space-separated list of values. If we combine the FN and N we get something like this:

or worse choice for encoding

Microformats are a way to embed specific semantic data into the HTML that we use today. One of the first questions an XML guru might ask is "Why use HTML when XML lets you create the same semantics?" I won't go into all the reasons XML might be a better or worse choice for encoding data or why microformats have chosen to use HTML as their encoding base. This article will focus more on how to extract microformats data from the HTML, how the basic parsing rules work, and how they differ from XML.
Contact Information in HTML

One of the more popular and well-established microformats is hCard. This is a vCard representation in HTML, hence the h in hCard, HTML vCard. You can read more about hCards on the microformats wiki. A vCard contains basic information about a person or an organization. This format is used extensively in address book applications as a way to backup and interchange contact information. By Internet standards it's an old format, the specification is RFC2426 from 1998. It is pre-XML, so the syntax is just simple text with a few delimiters and start and end elements. We'll use my information for this example.

width="280" height="225"

Labels