Hi,
i have the xml below and would like to extract the sessionname where session id == 0.
I am using this query but it does not work:
foreach my $tag ($doc->findnodes(('//sessions/session[@id="0"]/sessionname/text()'))){
print $tag->value();
}
Will this query work at all or will i need to do another findnotes in that node or mayby something else like findvalue? Some help to get me started would be great.
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
39
40
41
42
43
<?xml version="1.0" encoding="utf-8"?>
<sessions>
<session id="0">
<query_limit>20</query_limit>
<time_begin>08-27-2011</time_begin>
<searchvalue2>.+</searchvalue2>
<showwarn>1</showwarn>
<showna>1</showna>
<table_collums>3</table_collums>
<graph_height>100</graph_height>
<query_start>0</query_start>
<showok>1</showok>
<graph_width>300</graph_width>
<time_end>08-27-2012</time_end>
<searchvalue/>
<showcrit>1</showcrit>
<hostgroup>app-nagios</hostgroup>
<type>all</type>
<showunkn>1</showunkn>
<sessionname>unknown</sessionname>
<workload>0</workload>
</session>
<session id="1">
<query_limit>20</query_limit>
<time_begin>08-27-2011</time_begin>
<searchvalue2>.+</searchvalue2>
<showwarn>1</showwarn>
<showna>1</showna>
<table_collums>3</table_collums>
<graph_height>100</graph_height>
<query_start>0</query_start>
<showok>1</showok>
<graph_width>300</graph_width>
<time_end>08-27-2012</time_end>
<searchvalue/>
<showcrit>1</showcrit>
<hostgroup>app-nagios</hostgroup>
<type>all</type>
<showunkn>1</showunkn>
<sessionname>unknown</sessionname>
<workload>0</workload>
</session>
</sessions>
Last edited: 2012-08-28 11:04:22 +0200 (CEST)