XML

Element

Summary Included libraries Package variables Synopsis Description General documentation Methods

Summary
XML::Element - XML elements with the same interface as HTML::Element
Package variables top
No package variables defined.
Included modulestop
HTML::Element 3 .08 ( )
HTML::Tagset ( )
strict
Inherit top
HTML::Element
Synopsistop
  [See HTML::Element]
Descriptiontop
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.
Methodstop
_empty_element_mapNo descriptionCode
delete_ignorable_whitespaceNo descriptionCode

Methods description


Methods code

_empty_element_mapdescriptiontopprevnext
sub _empty_element_map {
\% emptyElement
}
delete_ignorable_whitespacedescriptiontopprevnext
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

CAVEATS top
Has currently no handling of namespaces.
SEE ALSO top
XML::TreeBuilder for a class that actually builds XML::Element
structures.

HTML::Element for all documentation.

XML::DOM and XML::Twig for other XML document tree interfaces.

XML::Generator for more fun.
COPYRIGHT top
Copyright 2000 Sean M. Burke.

This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
AUTHOR top
Sean M. Burke, sburke@cpan.orgE.org>