root/main/trunk/release-kits/shared/linux/XML-Parser/64-bit/perl-5.14/XML/Parser/Style/Objects.pm @ 29197

Revision 29197, 1.7 KB (checked in by ak19, 5 years ago)

Further XML::Parser binary files (for 64-bit linux, perl 5.14)

Line 
1# $Id: Objects.pm,v 1.1 2003-08-18 20:20:51 matt Exp $
2
3package XML::Parser::Style::Objects;
4use strict;
5
6sub Init {
7  my $expat = shift;
8  $expat->{Lists} = [];
9  $expat->{Curlist} = $expat->{Tree} = [];
10}
11
12sub Start {
13  my $expat = shift;
14  my $tag = shift;
15  my $newlist = [ ];
16  my $class = "${$expat}{Pkg}::$tag";
17  my $newobj = bless { @_, Kids => $newlist }, $class;
18  push @{ $expat->{Lists} }, $expat->{Curlist};
19  push @{ $expat->{Curlist} }, $newobj;
20  $expat->{Curlist} = $newlist;
21}
22
23sub End {
24  my $expat = shift;
25  my $tag = shift;
26  $expat->{Curlist} = pop @{ $expat->{Lists} };
27}
28
29sub Char {
30  my $expat = shift;
31  my $text = shift;
32  my $class = "${$expat}{Pkg}::Characters";
33  my $clist = $expat->{Curlist};
34  my $pos = $#$clist;
35 
36  if ($pos >= 0 and ref($clist->[$pos]) eq $class) {
37    $clist->[$pos]->{Text} .= $text;
38  } else {
39    push @$clist, bless { Text => $text }, $class;
40  }
41}
42
43sub Final {
44  my $expat = shift;
45  delete $expat->{Curlist};
46  delete $expat->{Lists};
47  $expat->{Tree};
48}
49
501;
51__END__
52
53=head1 NAME
54
55XML::Parser::Style::Objects
56
57=head1 SYNOPSIS
58
59  use XML::Parser;
60  my $p = XML::Parser->new(Style => 'Objects', Pkg => 'MyNode');
61  my $tree = $p->parsefile('foo.xml');
62
63=head1 DESCRIPTION
64
65This module implements XML::Parser's Objects style parser.
66
67This is similar to the Tree style, except that a hash object is created for
68each element. The corresponding object will be in the class whose name
69is created by appending "::" and the element name to the package set with
70the Pkg option. Non-markup text will be in the ::Characters class. The
71contents of the corresponding object will be in an anonymous array that
72is the value of the Kids property for that object.
73
74=head1 SEE ALSO
75
76L<XML::Parser::Style::Tree>
77
78=cut
Note: See TracBrowser for help on using the browser.