source:
vendors/XMLF90/current/doc/Tutorial/xpath/i.twoelements.f90
@
1960
Last change on this file since 1960 was 1960, checked in by flavoni, 14 years ago | |
---|---|
File size: 835 bytes |
Line | |
---|---|
1 | program twoelements |
2 | use flib_xpath |
3 | |
4 | type(xml_t) :: fxml |
5 | |
6 | integer :: status |
7 | character(len=100) :: what, price, currency |
8 | type(dictionary_t) :: attributes |
9 | |
10 | call open_xmlfile("inventory.xml",fxml,status) |
11 | ! |
12 | do |
13 | call get_node(fxml,path="//description", & |
14 | pcdata=what,status=status) |
15 | if (status < 0) exit ! No more items |
16 | ! |
17 | ! Price comes right after description... |
18 | ! |
19 | call get_node(fxml,path="//price", & |
20 | attributes=attributes,pcdata=price,status=status) |
21 | if (status /= 0) stop "missing price element!" |
22 | |
23 | call get_value(attributes,"currency",currency,status) |
24 | if (status /= 0) stop "missing currency attribute!" |
25 | |
26 | write(unit=*,fmt="(6a)") "Appliance: ", trim(what), & |
27 | ". Price: ", trim(price), " ", trim(currency) |
28 | enddo |
29 | end program twoelements |
Note: See TracBrowser
for help on using the repository browser.