| 1 | package CAM::XML::XMLTree; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | our $VERSION = '1.14'; | |||||||||
| 7 | |||||||||||
| 8 | =head1 NAME | ||||||||||
| 9 | |||||||||||
| 10 | CAM::XML::Text - XML text nodes | ||||||||||
| 11 | |||||||||||
| 12 | =head1 LICENSE | ||||||||||
| 13 | |||||||||||
| 14 | Copyright 2006 Clotho Advanced Media, Inc., <cpan@clotho.com> | ||||||||||
| 15 | |||||||||||
| 16 | This library is free software; you can redistribute it and/or modify it | ||||||||||
| 17 | under the same terms as Perl itself. | ||||||||||
| 18 | |||||||||||
| 19 | =head1 DESCRIPTION | ||||||||||
| 20 | |||||||||||
| 21 | This is a modified copy of XML::Parser::Tree from XML/Parser.pm | ||||||||||
| 22 | v2.30. It differs from the original in that each object is one | ||||||||||
| 23 | hashref instead of one scalar and one scalar/arrayref in the | ||||||||||
| 24 | object list. | ||||||||||
| 25 | |||||||||||
| 26 | =head1 FUNCTIONS | ||||||||||
| 27 | |||||||||||
| 28 | =over | ||||||||||
| 29 | |||||||||||
| 30 | =item Init() | ||||||||||
| 31 | |||||||||||
| 32 | =cut | ||||||||||
| 33 | |||||||||||
| 34 | sub Init | ||||||||||
| 35 | 0 | ▶ | { | ||||||||
|
Subroutine
Init: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 36 | 0 | my $expat = shift; | |||||||||
| 37 | 0 | $expat->{Stack} = []; | |||||||||
| 38 | 0 | $expat->{Package} = 'CAM::XML'; | |||||||||
| 39 | 0 | return; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | =item Start($tag) | ||||||||||
| 43 | |||||||||||
| 44 | =cut | ||||||||||
| 45 | |||||||||||
| 46 | sub Start | ||||||||||
| 47 | 0 | ▶ | { | ||||||||
|
Subroutine
Start: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 48 | 0 | my $expat = shift; | |||||||||
| 49 | 0 | my $tag = shift; | |||||||||
| 50 | |||||||||||
| 51 | 0 | my $obj = $expat->{Package}->new($tag, @_); | |||||||||
| 52 | 0 | ▶ | if (!$expat->{Base}) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | { | ||||||||||
| 54 | 0 | $expat->{Base} = $obj; | |||||||||
| 55 | } | ||||||||||
| 56 | 0 | ▶ | if (@{ $expat->{Stack} } > 0) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 57 | { | ||||||||||
| 58 | 0 | $expat->{Stack}->[-1]->add($obj); | |||||||||
| 59 | } | ||||||||||
| 60 | 0 | push @{ $expat->{Stack} }, $obj; | |||||||||
| 61 | 0 | return; | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | =item End($tag) | ||||||||||
| 65 | |||||||||||
| 66 | =cut | ||||||||||
| 67 | |||||||||||
| 68 | sub End | ||||||||||
| 69 | 0 | ▶ | { | ||||||||
|
Subroutine
End: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 70 | 0 | my $expat = shift; | |||||||||
| 71 | 0 | my $tag = shift; | |||||||||
| 72 | 0 | pop @{ $expat->{Stack} }; | |||||||||
| 73 | 0 | delete $expat->{Cdata}; | |||||||||
| 74 | 0 | return; | |||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | =item Char($text) | ||||||||||
| 78 | |||||||||||
| 79 | =cut | ||||||||||
| 80 | |||||||||||
| 81 | sub Char | ||||||||||
| 82 | 0 | ▶ | { | ||||||||
|
Subroutine
Char: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 83 | 0 | my $expat = shift; | |||||||||
| 84 | 0 | my $text = shift; | |||||||||
| 85 | |||||||||||
| 86 | $expat->{Stack}->[-1] | ||||||||||
| 87 | 0 | ▶ | ->add(($expat->{Cdata} ? '-cdata' : '-text') => $text); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 88 | 0 | return; | |||||||||
| 89 | } | ||||||||||
| 90 | |||||||||||
| 91 | =item CdataStart() | ||||||||||
| 92 | |||||||||||
| 93 | =cut | ||||||||||
| 94 | |||||||||||
| 95 | sub CdataStart | ||||||||||
| 96 | 0 | ▶ | { | ||||||||
|
Subroutine
CdataStart: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 97 | 0 | my $expat = shift; | |||||||||
| 98 | 0 | $expat->{Cdata} = 1; | |||||||||
| 99 | 0 | return; | |||||||||
| 100 | } | ||||||||||
| 101 | |||||||||||
| 102 | =item CdataEnd() | ||||||||||
| 103 | |||||||||||
| 104 | =cut | ||||||||||
| 105 | |||||||||||
| 106 | sub CdataEnd | ||||||||||
| 107 | 0 | ▶ | { | ||||||||
|
Subroutine
CdataEnd: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 108 | 0 | my $expat = shift; | |||||||||
| 109 | 0 | delete $expat->{Cdata}; | |||||||||
| 110 | 0 | return; | |||||||||
| 111 | } | ||||||||||
| 112 | |||||||||||
| 113 | =item Final() | ||||||||||
| 114 | |||||||||||
| 115 | =cut | ||||||||||
| 116 | |||||||||||
| 117 | sub Final | ||||||||||
| 118 | 0 | ▶ | { | ||||||||
|
Subroutine
Final: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 119 | 0 | my $expat = shift; | |||||||||
| 120 | 0 | delete $expat->{Stack}; | |||||||||
| 121 | 0 | return delete $expat->{Base}; | |||||||||
| 122 | } | ||||||||||
| 123 | |||||||||||
| 124 | 2 | 1; | |||||||||
| 125 | __END__ | ||||||||||