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

source: vendors/XMLF90/current/doc/Examples/sax/simple/i.m_handlers.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.3 KB
Line 
1module m_handlers
2
3use flib_sax
4
5private
6
7!
8! It defines the routines that are called by the XML parser in response
9! to particular events.
10!
11! In this particular example we just print the names of the elements,
12! the attribute list, and the content of the pcdata chunks
13!
14! A module such as this could use "utility routines" to convert pcdata
15! to numerical arrays, and to populate specific data structures.
16!
17public :: begin_element_handler, end_element_handler, pcdata_chunk_handler
18
19CONTAINS  !=============================================================
20
21subroutine begin_element_handler(name,attributes)
22character(len=*), intent(in)   :: name
23type(dictionary_t), intent(in) :: attributes
24
25write(unit=*,fmt="(2a)") ">>Begin Element: ", name
26write(unit=*,fmt="(a,i2,a)") "--- ", len(attributes), " attributes:"
27call print_dict(attributes)
28end subroutine begin_element_handler
29
30!--------------------------------------------------
31subroutine end_element_handler(name)
32character(len=*), intent(in)     :: name
33
34  write(unit=*,fmt="(/,2a)") ">>-------------End Element: ", trim(name)
35
36end subroutine end_element_handler
37
38!--------------------------------------------------
39subroutine pcdata_chunk_handler(chunk)
40character(len=*), intent(in) :: chunk
41
42write(unit=*,fmt="(a)",advance="no") trim(chunk)
43
44end subroutine pcdata_chunk_handler
45
46end module m_handlers
47
48
49
50
51
52
53
54
55
56
57
58
Note: See TracBrowser for help on using the repository browser.