File: TagsToUpper.pm

package info (click to toggle)
libxml-simple-perl 2.25-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 428 kB
  • sloc: perl: 1,137; xml: 47; makefile: 2
file content (38 lines) | stat: -rwxr-xr-x 716 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package TagsToUpper;

use XML::SAX::Base;

use vars qw(@ISA);

@ISA = ('XML::SAX::Base');

sub start_element {
  my $self    = shift;
  my $element = shift;

#  print Data::Dumper->Dump([$element], ['element']);
  to_upper($element);
  foreach (values(%{$element->{Attributes}})) { to_upper($_); }

  $self->SUPER::start_element($element);
}

sub end_element {
  my $self    = shift;
  my $element = shift;

  to_upper($element);

  $self->SUPER::end_element($element);
}

sub to_upper {
  my $ref = shift;

  $ref->{LocalName} = uc($ref->{LocalName}) if($ref->{LocalName});
  $ref->{Name}      = uc($ref->{Name})      if($ref->{LocalName});
  $ref->{Prefix}    = uc($ref->{Prefix})    if($ref->{LocalName});
}

1;