source: XMLF90/doc/Examples/xpath/relative.f90 @ 6

Last change on this file since 6 was 6, checked in by ymipsl, 15 years ago

Import des sources XMLF90

File size: 1.2 KB
Line 
1program relative
2!
3! Example of XPATH-lite  processing
4!
5use flib_xpath
6
7type(dictionary_t) :: attributes
8type(xml_t) :: fxml
9
10integer  :: status
11
12call open_xmlfile("Ba.xml",fxml,status)
13if (status /=0) then
14   print * , "Cannot open file."
15   stop
16endif
17
18!call enable_debug(sax=.false.)
19
20!
21job_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
51enddo job_search
52
53end 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.