1XML::XPath::PerlSAX(3)User Contributed Perl DocumentationXML::XPath::PerlSAX(3)
2
3
4
6 XML::XPath::PerlSAX - A PerlSAX event generator for my weird node
7 structure
8
10 use XML::XPath;
11 use XML::XPath::PerlSAX;
12 use XML::DOM::PerlSAX;
13
14 my $xp = XML::XPath->new(filename => 'test.xhtml');
15 my $paras = $xp->find('/html/body/p');
16
17 my $handler = XML::DOM::PerlSAX->new();
18 my $generator = XML::XPath::PerlSAX->new( Handler => $handler );
19
20 foreach my $node ($paras->get_nodelist) {
21 my $domtree = $generator->parse($node);
22 # do something with $domtree
23 }
24
26 This module generates PerlSAX events to pass to a PerlSAX handler such
27 as XML::DOM::PerlSAX. It operates specifically on my weird tree format.
28
29 Unfortunately SAX doesn't seem to cope with namespaces, so these are
30 lost completely. I believe SAX2 is doing namespaces.
31
33 The XML::DOM::PerlSAX handler I tried was completely broken (didn't
34 even compile before I patched it a bit), so I don't know how correct
35 this is or how far it will work.
36
38 This module is copyright 2000 AxKit.com Ltd. This is free software,
39 and as such comes with NO WARRANTY. No dates are used in this module.
40 You may distribute this module under the terms of either the Gnu GPL,
41 or the Artistic License (the same terms as Perl itself).
42
43
44
45perl v5.28.0 2018-10-10 XML::XPath::PerlSAX(3)