# man > XML::XPath::PerlSAX(3pm)

---
type: CommandReference
command: XML::XPath::PerlSAX
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference

- `XML::XPath::PerlSAX->new(Handler => $handler)` — create a PerlSAX event generator for an XPath node tree
- `$generator->parse($node)` — generate PerlSAX events for a given node, passing them to the handler

## Name

`XML::XPath::PerlSAX` — A PerlSAX event generator for the XML::XPath node structure

## Synopsis

perl
use XML::XPath;
use XML::XPath::PerlSAX;
use XML::DOM::PerlSAX;

my $xp = XML::XPath->new(filename => 'test.xhtml');
my $paras = $xp->find('/html/body/p');

my $handler = XML::DOM::PerlSAX->new();
my $generator = XML::XPath::PerlSAX->new( Handler => $handler );

foreach my $node ($paras->get_nodelist) {
    my $domtree = $generator->parse($node);
    # do something with $domtree
}
## Description

This module generates PerlSAX events to pass to a PerlSAX handler such as `XML::DOM::PerlSAX`. It operates on the XML::XPath node tree.

SAX does not cope with namespaces, so they are lost completely. SAX2 is expected to handle namespaces.

**Note:** The `XML::DOM::PerlSAX` handler is reported as broken (did not even compile without patching). The correctness and completeness of this module are unknown.

## License and Copyright

Copyright 2000 AxKit.com Ltd. This is free software, licensed under the Gnu GPL or the Artistic License (same terms as Perl itself). No dates are used.