1XPath::PerlSAX(3) User Contributed Perl Documentation XPath::PerlSAX(3)
2
3
4
6 XML::XPath::PerlSAX - A PerlSAX event generator for my wierd 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 wierd 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
37 This software may only be distributed as part of the XML::XPath
38 package.
39
40
41
42perl v5.16.3 2000-02-28 XPath::PerlSAX(3)