The category element associates your entry or feed with a designated category. The term “category” is used loosely here as a category within the context of Atom could just as easily be a “tag” (like those used in LiveJournal, Flickr or del.icio.us), or a “category” (like those used in TypePad or Movable Type).
The term attribute is a string that identifies the category to which the entry or feed belongs. The term attribute does not necessarily need to be optimized for human readability (which is what the “label” attribute is intended to convey), but instead is the term used or issued by the server. This is a required element.
The category scheme identifies the categorization scheme associated with this catagory. This attribute can be used for example to differentiate between tags and categories.
The “label” attribute provides a human-readable label for display in end-user applications. The content of the “label” attribute is Language-Sensitive. Entities such as “&” and “<” represent their corresponding characters (“&” and “<”, respectively), not markup.
Discussion and Examples
Sometimes there is a need for the term and the label for a category to differ significantly. For example in heirarchical category schemes an application needs to know not only the name of the category, but also the location of that category within the heirarchy. The following example we should how the category tag can be used to represent a heirarchical category.
<category term="/Animals/Mammals/Canines/Boston_Terriers" scheme="sixapart:category" label="Boston Terriers" />
Note that the term attribute is the canonical form of the category and includes the heirarchical information about the category. The label attribute is then used to provide the application with a human readable version of the category that can be displayed directly to a user.
Tags are another type of category, they are just more loosely structured and defined. But one thing that tags have in common with categories is that the term and label attributes may need to be different. For example, all the following tags should all be semantically equivalent:
- new york
- New York
Because tagging systems do not impose pre-defined structures upon its user selecting tags, tagging systems will often attempt to normalize tags into a canonical form. For example, any one of the tags above could be represented as follows in an Atom feed:
<category term="newyork" scheme="sixapart:tag" label="New York" />