Leser: 1
6 Einträge, 1 Seite |
1
2
3
4
5
6
7
my $t= XML::Twig->new(
# the twig will include just the root and selected titles
twig_roots => { 'section/title' => \&print_n_purge,
'annex/title' => \&print_n_purge
}
);
$t->parsefile( 'doc.xml');
Quoteunrecognized expression in handler: 'cruisecontrol/testlog/units/testcase/description/additional/setting[@name="WorkingDir"]/value'
at ts_trace_test_ids.pl line 73
Quote> WARNING: (hopefully temporary) at the moment
> string_condition, regexp_condition and
> attribute_condition are only supported on a simple
> gi, not on a path.
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
#!/usr/bin/perl -w
use strict;
use XML::Twig;
my $file = "/Users/mem/Desktop/CV/test.xml";
my %cities;
my $twig = XML::Twig-> new(
KeepEncoding => 1,
TwigRoots => {'europe' => 1},
TwigHandlers => {'capitale[@lang="fr"]'
=> sub {$cities{$_[1]->text} = $_[1]->att("lang")}}
);
$twig-> parsefile($file);
$twig-> purge;
foreach my $key (keys %cities) {
print "$key = $cities{$key}\n";
}
6 Einträge, 1 Seite |