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/Tutorial/sax – NEMO

source: vendors/XMLF90/current/doc/Tutorial/sax/i.m_handlers.f90 @ 1963

Last change on this file since 1963 was 1963, checked in by flavoni, 14 years ago

importing XMLF90 r_53 vendor

File size: 1.6 KB
Line 
1module m_handlers
2use flib_sax
3private
4public :: begin_element, end_element, pcdata_chunk
5!
6logical, private            :: in_item, in_description, in_price
7character(len=40), private  :: what, price, currency, id
8!
9contains !-----------------------------------------
10!
11subroutine begin_element(name,attributes)
12   character(len=*), intent(in)     :: name
13   type(dictionary_t), intent(in)   :: attributes
14   
15   integer  :: status
16   
17   select case(name)
18     case("item")
19       in_item = .true.
20       call get_value(attributes,"id",id,status)
21     
22     case("description")
23       in_description = .true.
24       
25     case("price")
26       in_price = .true.
27       call get_value(attributes,"currency",currency,status)
28
29   end select
30   
31end subroutine begin_element
32!---------------------------------------------------------------
33subroutine pcdata_chunk(chunk)
34   character(len=*), intent(in) :: chunk
35
36   if (in_description) what = chunk
37   if (in_price) price = chunk
38
39end subroutine pcdata_chunk
40!---------------------------------------------------------------
41subroutine end_element(name)
42   character(len=*), intent(in)     :: name
43   
44   select case(name)
45     case("item")
46       in_item = .false.
47       write(unit=*,fmt="(5(a,tr1))") trim(id), trim(what), ":", &
48                                     trim(price), trim(currency)
49     
50     case("description")
51       in_description = .false.
52       
53     case("price")
54       in_price = .false.
55
56   end select
57   
58end subroutine end_element
59!---------------------------------------------------------------
60end module m_handlers
Note: See TracBrowser for help on using the repository browser.