Return an index of `id' attributes in a grove
use XML::Grove::IDs; # Using get_ids method on XML::Grove::Document or XML::Grove::Element: $hash = $grove_object->get_ids($attr_name, $elements); # Using an XML::Grove::IDs instance: $indexer = XML::Grove::IDs->new($attr_name, $elements); my $hash = {}; $grove_object->accept($indexer, $hash);
\*(C`XML::Grove::IDs\*(C' returns a hash index of all nodes in a grove with an `id' attribute. The keys of the hash are the \s-1ID\s0 attribute value and the value at that key is the element. `$attr_name' and `$elements' are optional. The attribute name defaults to `\*(C`id\*(C'' if `$attr_name' is not supplied. Indexing can be restricted to only certain elements, by name, by providing a hash containing NAME=>1 values.
Ken MacLeod, [email protected]
perl\|(1), XML::Grove\|(3), Data::Grove::Visitor\|(3)
Extensible Markup Language (\s-1XML\s0) <http://www.w3c.org/XML>