HTML::...L::Node(3pm)
β¨ NAME β¨
okay bestie so like, this is HTML::TreeBuilder::LibXML::Node β it's an HTML::Element compatible API for HTML::TreeBuilder::LibXML. that's the whole vibe. one node class, wearing an HTML::Element costume, slaying π
this page lives in the User Contributed Perl Documentation section, and the manual page you're reading rn is HTML::...L::Node(3pm) (yes the name is abbreviated like that, no we're not gonna fight about it π«Ά).
πΈ SYNOPSIS πΈ
here's literally every method call this node can do for you, copied exactly, no notes:
my $value = $node->attr('name');
my $string = $node->string_value;
my $text = $node->as_text;
my $t_text = $node->as_trimmed_text;
my $xml = $node->as_XML;
my $html = $node->as_HTML;
my $tag = $node->tag;
my $id = $node->id;
my $clone = $node->clone;
$node->delete;
my $prev_sib = $node->left;
my $next_sib = $node->right;
$node->look_down(@args);
my %attr = $node->all_attr;
my %attr = $node->all_external_attr;
my @names = $node->all_attr_names;
my @names = $node->all_external_attr_names;
my @elements = $node->find($elem_name);
my @child_nodes = $node->content_list;
my $parent = $node->parent;
my $old_parent = $node->detach;
$node->postinsert($element_or_text, ...);
$node->preinsert($element_or_text, ...);
$node->push_content($element_or_text, ...);
$node->unshift_content($element_or_text, ...);
$node->replace_with($element_or_text, ...);
my @clones = HTML::TreeBuilder::LibXML::Node->clone_list(@nodes);
# HTML::TreeBuilder::XPath
my @nodes = $node->find($xpath)
my @nodes = $node->findnodes($xpath);
my $value = $node->findvalue($xpath);
my @values = $node->findvalues($xpath);
$node->isTextNode;
my $child = $node->getFirstChild;
my $bool = $node->exists($xpath);
my $bool = $node->matches($xpath);
my $value = $node->findnodes_as_string($xpath);
my @values = $node->findnodes_as_strings($xpath);
ok that's genuinely the whole page, no cap. it's giving "short and iconic" π go read HTML::Element if you wanna know what each of those does, because this one's whole thing is being compatible with it β the XPath-flavoured extras at the bottom are the HTML::TreeBuilder::XPath block, iykyk π¦
also quick heads up: those last twofindnodeslines under the# HTML::TreeBuilder::XPathcomment have no semicolons in the original and I am not touching them. character for character, bestie. that's the rule π
that's a wrap, babe β this was perl v5.38.2, dated 2024-08-03, and honestly? ate. β¨ππ
π¦ where this page comes from
- debian trixie: libhtml-treebuilder-libxml-perl 0.28-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-treebuilder-libxml-perl 0.28-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhtml-treebuilder-libxml-perl 0.28-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms