summaryrefslogtreecommitdiff
path: root/Xerl/XML
diff options
context:
space:
mode:
Diffstat (limited to 'Xerl/XML')
-rw-r--r--Xerl/XML/Element.pm2
-rw-r--r--Xerl/XML/Reader.pm13
-rw-r--r--Xerl/XML/SAXHandler.pm29
3 files changed, 21 insertions, 23 deletions
diff --git a/Xerl/XML/Element.pm b/Xerl/XML/Element.pm
index 4edade2..9aa3c2f 100644
--- a/Xerl/XML/Element.pm
+++ b/Xerl/XML/Element.pm
@@ -2,7 +2,7 @@
#
# E-Mail: xerl@dev.buetow.org WWW: http://xerl.buetow.org
#
-# This is free software, you may use it and distribute it under the same
+# This is free software, you may use it and distribute it under the same
# terms as Perl itself.
package Xerl::XML::Element;
diff --git a/Xerl/XML/Reader.pm b/Xerl/XML/Reader.pm
index 1828e18..176f405 100644
--- a/Xerl/XML/Reader.pm
+++ b/Xerl/XML/Reader.pm
@@ -2,7 +2,7 @@
#
# E-Mail: xerl@dev.buetow.org WWW: http://xerl.buetow.org
#
-# This is free software, you may use it and distribute it under the same
+# This is free software, you may use it and distribute it under the same
# terms as Perl itself.
package Xerl::XML::Reader;
@@ -21,7 +21,8 @@ sub open($) {
if ( -f $self->get_path() ) {
return 0;
- } else {
+ }
+ else {
return 1;
}
}
@@ -30,13 +31,11 @@ sub parse() {
my Xerl::XML::Reader $self = $_[0];
my $sax_handler = Xerl::XML::SAXHandler->new();
- my $parser = XML::SAX::ParserFactory->parser(
- Handler => $sax_handler
- );
+ my $parser = XML::SAX::ParserFactory->parser( Handler => $sax_handler );
- $parser->parse_uri($self->get_path());
+ $parser->parse_uri( $self->get_path() );
- $self->set_root($sax_handler->{xerl}{root});
+ $self->set_root( $sax_handler->{xerl}{root} );
return undef;
}
diff --git a/Xerl/XML/SAXHandler.pm b/Xerl/XML/SAXHandler.pm
index 0b6b425..47febc2 100644
--- a/Xerl/XML/SAXHandler.pm
+++ b/Xerl/XML/SAXHandler.pm
@@ -2,7 +2,7 @@
#
# E-Mail: xerl@dev.buetow.org WWW: http://xerl.buetow.org
#
-# This is free software, you may use it and distribute it under the same
+# This is free software, you may use it and distribute it under the same
# terms as Perl itself.
package Xerl::XML::SAXHandler;
@@ -20,39 +20,38 @@ use Xerl::Base;
use Xerl::XML::Element;
sub start_document {
- my ($self, $doc) = @_;
+ my ( $self, $doc ) = @_;
- $self->{xerl}{root} = undef;
+ $self->{xerl}{root} = undef;
$self->{xerl}{current} = undef;
- $self->{xerl}{stack} = [];
-
+ $self->{xerl}{stack} = [];
return undef;
}
sub start_element {
- my ($self, $doc) = @_;
+ my ( $self, $doc ) = @_;
my $x = $self->{xerl};
- if (defined $x->{current}) {
- push @{$x->{stack}}, $x->{current};
+ if ( defined $x->{current} ) {
+ push @{ $x->{stack} }, $x->{current};
$x->{root} = $x->{current} unless defined $x->{root};
}
- my %params = map { $_->{Name} => $_->{Value} } values %{$doc->{Attributes}};
+ my %params = map { $_->{Name} => $_->{Value} } values %{ $doc->{Attributes} };
$x->{current} = Xerl::XML::Element->new();
$x->{current}->set_text('');
- $x->{current}->set_name($doc->{Name});
- $x->{current}->set_params(\%params) if %params;
+ $x->{current}->set_name( $doc->{Name} );
+ $x->{current}->set_params( \%params ) if %params;
- ${$x->{stack}}[-1]->push_array($x->{current}) if @{$x->{stack}};
+ ${ $x->{stack} }[-1]->push_array( $x->{current} ) if @{ $x->{stack} };
return undef;
}
sub characters {
- my ($self, $doc) = @_;
+ my ( $self, $doc ) = @_;
my $x = $self->{xerl};
my $data = $doc->{Data};
@@ -66,10 +65,10 @@ sub characters {
}
sub end_element {
- my ($self, $doc) = @_;
+ my ( $self, $doc ) = @_;
my $x = $self->{xerl};
- $x->{current} = pop @{$x->{stack}};
+ $x->{current} = pop @{ $x->{stack} };
return undef;
}