DESCRIPTION

Microformat objects need context when being parsed to properly make sense. For example, a base \s-1URI\s0 is needed to resolve relative \s-1URI\s0 references, and a full copy of the \s-1DOM\s0 tree is needed to implement the include pattern.

Constructor

Creates a new context from a \s-1DOM\s0 document and a base \s-1URI\s0. $dom will be modified, so if you care about keeping it pristine, make a clone first.

Public Methods

A Microformat cache for the context. This prevents the same microformat object from being parsed and reparsed - e.g. an adr parsed first in its own right, and later as a child of an hCard. Return the modified \s-1DOM\s0 document. Called without a parameter, returns the context's base \s-1URI\s0. Called with a parameter, resolves the \s-1URI\s0 reference relative to the base \s-1URI\s0. Returns a \s-1URI\s0 representing the document itself. (Usually the same as the base \s-1URI\s0.) Mint a blank node identifier or a \s-1URI\s0. If an element is passed, this may be used to construct a \s-1URI\s0 in some way. A list of profile URIs declared by the document. Returns true iff any of the profiles in the array are declared by the document. Declare these additional profiles. Returns the hCard for the person that is \*(L"represented by\*(R" the page (in the \s-1XFN\s0 sense), or undef if no suitable hCard could be found Equivalent to calling \*(C`$context->representative_hcard->id($as_trine, 'holder')\*(C', however magically works even if $context->representative_hcard returns undef. Returns the hCard for the contact person for the page, or undef if none can be found. hCards are considered potential contact hCards if they are contained within an \s-1HTML\s0 <address> tag, or their root element is an <address> tag. If there are several such hCards, then the one in the shallowest <address> tag is used; if there are several <address> tags equally shallow, the first is used. Equivalent to calling \*(C`$context->contact_hcard->id($as_trine, 'holder')\*(C', however magically works even if $context->contact_hcard returns undef.

BUGS

Please report any bugs to <http://rt.cpan.org/>.

RELATED TO HTML::Microformats::DocumentContext…

HTML::Microformats

AUTHOR

Toby Inkster <[email protected]>.

COPYRIGHT AND LICENCE

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.

DISCLAIMER OF WARRANTIES

\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.