HTML::Microformats::Utilities - utility functions for searching and manipulating HTML
This module includes a few functions for searching and manipulating HTML trees.
searchClass($class, $node, [$prefix])
Returns a list of elements which are descendents of $node and have class name $class.
$class can be a plain string, or a regular expression.
If $prefix is supplied it is used as an optional prefix for $class. For example, with $class 'bar' and $prefix 'foo', searchClass will look for all of the following classes: 'bar', 'foobar', 'foo-bar' and 'foo:bar'.
searchAncestorClass($class, $node, [$skip])
Returns the first element which is an ancestor of $node having class name $class.
$skip is the number of levels of ancestor to skip. If $skip is 0, then potentially searchAncestorClass will return $node itself. If $skip is 1, then it will not return $node but could potentially return its parent, and so on.
searchRel($relationship, $node)
Returns a list of elements which are descendents of $node and have relationship $relationship.
$relationship can be a plain string, or a regular expression.
searchRev($relationship, $node)
As per searchRel, but uses the rev attribute.
searchID($id, $node)
Returns a descendent of $node with id attribute $id, or undef.
searchAncestorTag($tagname, $node)
Returns the nearest ancestor of $node with tag name $tagname, or undef.
stringify($node, \%options)
Returns a stringified version of a DOM element. This is conceptually equivalent to $node->textContent, but follows microformat-specific stringification rules, including value excerption, the abbr pattern and so on.
$node->textContent
xml_stringify($node)
Returns an XML serialisation of a DOM element. This is conceptually equivalent to $node->toStringEC14N, but hides certain attributes which HTML::Microformats::DocumentContext adds for internal processing.
$node->toStringEC14N
Please report any bugs to http://rt.cpan.org/.
HTML::Microformats.
Toby Inkster <tobyink@cpan.org>.
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.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
To install HTML::Microformats, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Microformats
CPAN shell
perl -MCPAN -e shell install HTML::Microformats
For more information on module installation, please visit the detailed CPAN module installation guide.