# man > XML::Grove::IDs

## NAME
    [XML::Grove::IDs](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AGrove%3A%3AIDs/markdown) - return an index of `id' attributes in a grove

## SYNOPSIS
     use [XML::Grove::IDs](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AGrove%3A%3AIDs/markdown);

     # Using get_ids method on [XML::Grove::Document](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AGrove%3A%3ADocument/markdown) or [XML::Grove::Element](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AGrove%3A%3AElement/markdown):
     $hash = $grove_object->get_ids($attr_name, $elements);

     # Using an [XML::Grove::IDs](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AGrove%3A%3AIDs/markdown) instance:
     $indexer = [XML::Grove::IDs](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AGrove%3A%3AIDs/markdown)->new($attr_name, $elements);
     my $hash = {};
     $grove_object->accept($indexer, $hash);

## DESCRIPTION
    "[XML::Grove::IDs](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AGrove%3A%3AIDs/markdown)" returns a hash index of all nodes in a grove with an `id' attribute. The keys
    of the hash are the ID attribute value and the value at that key is the element. `$attr_name'
    and `$elements' are optional. The attribute name defaults to `"id"' if `$attr_name' is not
    supplied. Indexing can be restricted to only certain elements, by name, by providing a hash
    containing NAME=>1 values.

## AUTHOR
    Ken MacLeod, <ken@bitsko.slc.ut.us>

## SEE ALSO
### perl

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

