[Pidgin] #10130: Missing Perl method allowing recursive walk through all children of a XMLNode.
Pidgin
trac at pidgin.im
Fri Aug 28 12:07:38 EDT 2009
#10130: Missing Perl method allowing recursive walk through all children of a
XMLNode.
------------------+---------------------------------------------------------
Reporter: mcepl | Type: defect
Status: new | Component: plugins
Version: 2.6.1 | Keywords:
------------------+---------------------------------------------------------
In a Perl extension I would like to eliminate all <img/> elements
in a given XMLNode. I tried this function:
{{{
sub clear_img {
my $curnode = shift ;
my $curname = $curnode->get_name();
Purple::Debug::misc("$pluginName",
"clear_img: current node name is "
. $curname . "\n");
if ($curname eq "img") {
$curnode->free();
return ;
}
# doesn't work in perl ... it would be curnode->child in C
my $curchild = $curnode->get_child("");
while ($curchild) {
clear_img($curchild);
$curchild = $curnode->get_next_twin();
}
}
}}}
However, it doesn't seem to work because $curnode->get_child("")
is an invalid call and of course $curnode->get_next_twin() fails
as well. I would need a function (property, whatever) getting me
ANY child of a given XMLNode.
--
Ticket URL: <http://developer.pidgin.im/ticket/10130>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list