GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
XML::Grove::Sub(3) User Contributed Perl Documentation XML::Grove::Sub(3)

XML::Grove::Sub - run a filter sub over a grove

 use XML::Grove::Sub;

 # Using filter method on XML::Grove::Document or XML::Grove::Element:
 @results = $grove_object->filter(\&sub [, ...]);

 # Using an XML::Grove::Sub instance:
 $filterer = XML::Grove::Sub->new();
 @results = $grove_object->accept($filterer, \&sub [, ...]);

"XML::Grove::Sub" executes a sub, the filter, over all objects in a grove and returns a list of all the return values from the sub. The sub is called with the grove object as it's first parameter and passing the rest of the arguments to the call to `"filter()"' or `"accept()"'.

The following filter will return a list of all `"foo"' or `"bar"' elements with an attribute `"widget-no"' beginning with `"A"' or `"B"'.

  @results = $grove_obj->filter(sub {
      my $obj = shift;

      if ($obj->isa('XML::Grove::Element')
          && (($obj->{Name} eq 'foo')
              || ($obj->{Name} eq 'bar'))
          && ($obj->{Attributes}{'widget-no'} =~ /^[AB]/)) {
          return ($obj);
      }
      return ();
  });

Ken MacLeod, ken@bitsko.slc.ut.us

perl(1), XML::Grove(3), Data::Grove::Visitor(3)

Extensible Markup Language (XML) <http://www.w3c.org/XML>

1999-09-02 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.