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 two findnodes lines under the # HTML::TreeBuilder::XPath comment 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