New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
relative.f90 in vendors/XMLF90/current/doc/Examples/xpath – NEMO

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

importing XMLF90 r_53 vendor

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.