NAME
HTML::Linear::Path - represent paths inside HTML::Tree
VERSION
version 0.019
SYNOPSIS
use HTML::Linear::Path;
my $level = HTML::Linear::Path->new({
address => q(0.1.1.3.0),
attributes => {
id => q(li1),
},
strict => 0,
tag => q(li),
});
ATTRIBUTES
json
Lazy JSON instance.
address
Location inside HTML::TreeBuilder tree.
attributes
Element attributes.
key
Stringified path representation.
strict
Strict mode disables grouping by tags/attributes listed in "%HTML::Linear::Path::groupby".
tag
Tag name.
METHODS
as_string
Build a quick & dirty string representation of a path the HTML::TreeBuilder structure.
as_xpath
Build a nice XPath representation of a path inside the HTML::TreeBuilder structure.
weight
Return tag weight.
FUNCTIONS
_quote
Quote attribute values for XPath representation.
_wrap
Help to make a fancy XPath.
_isgroup($tag, $attribute)
Checks if $tag
/$attribute
tuple matches "%HTML::Linear::Path::groupby".
GLOBALS
%HTML::Linear::Path::groupby
Tags/attributes significant as XPath filters. @class
/@id
are the most obvious; we also use meta/@property
, input/@name
and several others.
%HTML::Linear::Path::tag_weight
Table of HTML tag weights. Borrowed from TexNet32 - WWW filters.
%HTML::Linear::Path::xpath_wrap
Wrap XPath components to produce fancy syntax highlight.
The format is:
(
array => ['' => ''],
attribute => ['' => ''],
equal => ['' => ''],
number => ['' => ''],
separator => ['' => ''],
sigil => ['' => ''],
tag => ['' => ''],
value => ['' => ''],
)
There are several pre-defined schemes at HTML::Linear::Path::Colors.
AUTHOR
Stanislaw Pusep <stas@sysd.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Stanislaw Pusep.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.