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.
simple.f90 in vendors/XMLF90/current/doc/Tutorial/sax – NEMO

source: vendors/XMLF90/current/doc/Tutorial/sax/simple.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: 887 bytes
Line 
1module m_aux
2use flib_sax
3private
4public :: begin_element_print
5
6contains !---------------- handler subroutine follows
7
8subroutine begin_element_print(name,attributes)
9   character(len=*), intent(in)     :: name
10   type(dictionary_t), intent(in)   :: attributes
11   
12   character(len=3)  :: id
13   integer           :: status
14   
15   print *, "Start of element: ", name
16   if (has_key(attributes,"id")) then
17      call get_value(attributes,"id",id,status)
18      print *, "  Id attribute: ", id
19   endif
20end subroutine begin_element_print
21
22end module m_aux
23
24program simple
25use flib_sax
26use m_aux
27
28type(xml_t)        :: fxml      ! XML file object (opaque)
29integer            :: iostat    ! Return code (0 if OK)
30
31call open_xmlfile("inventory.xml",fxml,iostat)
32if (iostat /= 0) stop "cannot open xml file"
33
34call xml_parse(fxml, begin_element_handler=begin_element_print)
35
36
37end program simple
Note: See TracBrowser for help on using the repository browser.