source:
vendors/XMLF90/current/doc/Examples/xpath/relative.f90
@
1960
Last change on this file since 1960 was 1960, checked in by flavoni, 14 years ago | |
---|---|
File size: 1.2 KB |
Rev | Line | |
---|---|---|
[1960] | 1 | program relative |
2 | ! | |
3 | ! Example of XPATH-lite processing | |
4 | ! | |
5 | use flib_xpath | |
6 | ||
7 | type(dictionary_t) :: attributes | |
8 | type(xml_t) :: fxml | |
9 | ||
10 | integer :: status | |
11 | ||
12 | call open_xmlfile("Ba.xml",fxml,status) | |
13 | if (status /=0) then | |
14 | print * , "Cannot open file." | |
15 | stop | |
16 | endif | |
17 | ||
18 | !call enable_debug(sax=.false.) | |
19 | ||
20 | ! | |
21 | job_search: do | |
22 | ! | |
23 | ! This will search for all the 'job' elements and all the | |
24 | ! 'shell' elements with l=0 contained in them at any depth | |
25 | ! (relative search). | |
26 | ||
27 | call mark_node(fxml,path="/atom/job",attributes=attributes,status=status) | |
28 | if (status /= 0) then | |
29 | print *, "No more 'job' elements" | |
30 | exit job_search | |
31 | else | |
32 | print *, ">>>>>>>>>>> New job: " | |
33 | call print_dict(attributes) | |
34 | endif | |
35 | ||
36 | shell_search: do | |
37 | ! | |
38 | ! The initial dot (.) signals a relative search | |
39 | ! | |
40 | call get_node(fxml,path=".//shell",att_name="l", & | |
41 | att_value="0",attributes=attributes,status=status) | |
42 | if (status /= 0) then | |
43 | print *, "end of job" | |
44 | exit shell_search | |
45 | endif | |
46 | print *, " Found Shell with l=0: " | |
47 | call print_dict(attributes) | |
48 | print *, "------------------------------------***" | |
49 | enddo shell_search | |
50 | ||
51 | enddo job_search | |
52 | ||
53 | end program relative | |
54 | ||
55 | ||
56 | ||
57 | ||
58 | ||
59 | ||
60 | ||
61 | ||
62 | ||
63 | ||
64 | ||
65 | ||
66 | ||
67 |
Note: See TracBrowser
for help on using the repository browser.