The xoxo microformat
use HTML::Microformats::DocumentContext; use HTML::Microformats::Format::XOXO; my $context = HTML::Microformats::DocumentContext->new($dom, $uri); my @objects = HTML::Microformats::Format::XOXO->extract_all( $dom->documentElement, $context); my $list = $objects[0]; # Let's assume this structure: # # <ol class="xoxo people"> # <li> # <a href="http://tobyinkster.co.uk/">Toby Inkster</a> # <dl> # <dt>Eye colour</dt> # <dd>Blue</dt> # <dt>Hair colour</dt> # <dd>Blonde</dt> # <dd>Brown</dt> # </dl> # </li> # </ol> print $list->data->as_array->[0]->get_link_title; # Toby Inkster print $list->data->as_array->[0]->get_properties ->get_value('Eye colour')->[0]; # Blue print join '-', $list->data->as_array->[0] ->get_value('Hair colour'); # Blonde-Brown
HTML::Microformats::Format::XOXO inherits from HTML::Microformats::Format. See the base class definition for a description of property getter/setter methods, constructors, etc.
Unlike most of the modules in the HTML::Microformats suite, the \*(C`data\*(C' method returns an HTML::Microformats::Format::XOXO::UL, HTML::Microformats::Format::XOXO::OL or HTML::Microformats::Format::XOXO::DL object, rather than a plain hashref.
Represents an \s-1HTML\s0 \s-1DL\s0 element. Treating a \s-1DL\s0 as a key-value structure, returns a list of values for a given key. Each value is an HTML::Microformats::Format::XOXO::DD object. Returns a hash of keys pointing to arrayrefs of values, where each value is an HTML::Microformats::Format::XOXO::DD object. Logically what you think get_values(\*(L"*\*(R") might do.
Represents an \s-1HTML\s0 \s-1UL\s0 element. Returns an array of values, where each is a HTML::Microformats::Format::XOXO::LI object.
Represents an \s-1HTML\s0 \s-1OL\s0 element. Returns an array of values, where each is a HTML::Microformats::Format::XOXO::LI object.
Represents an \s-1HTML\s0 \s-1LI\s0 element. Returns the \s-1URL\s0 linked to by the first link found within the item. Returns the value of the rel attribute of the first link found within the item. This is an unparsed string. Returns the value of the type attribute of the first link found within the item. This is an unparsed string. Returns the value of the rel attribute of the first link found within the item if present; the link text otherwise. Returns the value of the text in the \s-1LI\s0 element except for the first \s-1DL\s0 element within the \s-1LI\s0, and the first \s-1UL\s0 or \s-1OL\s0 element. Returns the \s-1HTML\s0 code in the \s-1LI\s0 element except for the first \s-1DL\s0 element within the \s-1LI\s0, and the first \s-1UL\s0 or \s-1OL\s0 element. Returns an HTML::Microformats::Format::XOXO::DL object representing the first \s-1DL\s0 element within the \s-1LI\s0. Returns an HTML::Microformats::Format::XOXO::OL or HTML::Microformats::Format::XOXO::UL object representing the first \s-1OL\s0 or \s-1UL\s0 element within the \s-1LI\s0. A shortcut for \*(C`$li->get_properties->get_values($key)\*(C'.
This has an identical interface to HTML::Microformats::Format::XOXO::LI.
HTML::Microformats::Format::XOXO supports \s-1XOXO\s0 as described at <http://microformats.org/wiki/xoxo>.
\s-1XOXO\s0 does not map especially naturally to \s-1RDF\s0, so this module returns the data as a \s-1JSON\s0 literal using the property <http://open.vocab.org/terms/json>.
Please report any bugs to <http://rt.cpan.org/>.
HTML::Microformats::Format, HTML::Microformats.
Toby Inkster <[email protected]>.
Copyright 2008-2012 Toby Inkster
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
\s-1THIS\s0 \s-1PACKAGE\s0 \s-1IS\s0 \s-1PROVIDED\s0 \*(L"\s-1AS\s0 \s-1IS\s0\*(R" \s-1AND\s0 \s-1WITHOUT\s0 \s-1ANY\s0 \s-1EXPRESS\s0 \s-1OR\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0, \s-1INCLUDING\s0, \s-1WITHOUT\s0 \s-1LIMITATION\s0, \s-1THE\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0 \s-1OF\s0 \s-1MERCHANTIBILITY\s0 \s-1AND\s0 \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0.