Last change
on this file since 2184 was
6,
checked in by ymipsl, 16 years ago
|
Import des sources XMLF90
|
File size:
887 bytes
|
Line | |
---|
1 | module m_aux |
---|
2 | use flib_sax |
---|
3 | private |
---|
4 | public :: begin_element_print |
---|
5 | |
---|
6 | contains !---------------- handler subroutine follows |
---|
7 | |
---|
8 | subroutine 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 |
---|
20 | end subroutine begin_element_print |
---|
21 | |
---|
22 | end module m_aux |
---|
23 | |
---|
24 | program simple |
---|
25 | use flib_sax |
---|
26 | use m_aux |
---|
27 | |
---|
28 | type(xml_t) :: fxml ! XML file object (opaque) |
---|
29 | integer :: iostat ! Return code (0 if OK) |
---|
30 | |
---|
31 | call open_xmlfile("inventory.xml",fxml,iostat) |
---|
32 | if (iostat /= 0) stop "cannot open xml file" |
---|
33 | |
---|
34 | call xml_parse(fxml, begin_element_handler=begin_element_print) |
---|
35 | |
---|
36 | |
---|
37 | end program simple |
---|
Note: See
TracBrowser
for help on using the repository browser.