XML
Element
XML::Element - XML elements with the same interface as HTML::Element
|
No package variables defined. |
HTML::Element 3 .08 ( ) |
HTML::Tagset ( ) |
strict |
This is just a subclass of HTML::Element. It works basically the same as HTML::Element, except that tagnames and attribute names aren't forced to lowercase, as they are in HTML::Element.
HTML::Element describes everything you can do with this class.
|
_empty_element_map | No description | Code |
delete_ignorable_whitespace | No description | Code |
Methods description
Methods code
_empty_element_map | description | top | prev | next |
sub _empty_element_map
{\% emptyElement
}
delete_ignorable_whitespace | description | top | prev | next |
sub delete_ignorable_whitespace
{ my $under_hash = $_[1];
my(@to_do) = ($_[0]);
if($under_hash and ref($under_hash) eq 'ARRAY') {
$under_hash = { map {; $_ => 1 } @$under_hash };
}
my $all = !$under_hash;
my($i,$this,$children);
while(@to_do) {
$this = shift @to_do;
$children = $this->content || next;
if(
($all or $under_hash->{$this->tag})
and @$children
) {
for($i = $##$children; $i >= 0; --$i) {
## work backwards thru the list
next if ref $children->[$i];
if($children->[$i] =~ m<^\s*$>s) { ## all WS
splice @$children, $i, 1; ## delete it.
}
}
}
unshift @to_do, grep ref($_), @$children; ## recurse
}
General documentation