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.
text.f90 in vendors/XMLF90/current/doc/Examples/dom – NEMO

source: vendors/XMLF90/current/doc/Examples/dom/text.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.5 KB
Line 
1program text
2
3  use flib_dom
4
5  implicit none
6
7  type(fnode), pointer :: myDoc, n
8  type(fnodeList), pointer :: myList, childList
9  type(string)  :: s
10
11  integer  :: i, j, nels
12
13  myDoc => parsefile("big-file.xml")!! , verbose=.true.)
14  print *, "allocated nodes: ", getNumberofAllocatedNodes()
15!  call dumpTree(myDoc)
16  call xmlize(myDoc,"dumptext.xml")
17
18  myList => getElementsbyTagName(myDoc, "para")
19  nels = getLength(myList)
20  print *, "number of para elements: ", nels
21  print *, "Dumping pure text under them..."
22  do i = 0, nels - 1
23     n => item(myList,i)
24     childList => getChildNodes(n)
25     do j = 0, getLength(childList) - 1
26        n => item(childList,j)
27        if (getNodeType(n) == TEXT_NODE) then
28           s = getNodeValue(n)
29           print *, "|", char(s), "|"
30        endif
31     enddo
32  enddo
33
34  print *, "Normalizing..."
35  print *, "===================================================="
36  call normalize(myDoc)
37!  call dumpTree(myDoc)
38  print *, "allocated nodes: ", getNumberofAllocatedNodes()
39 myList => getElementsbyTagName(myDoc, "para")
40  nels = getLength(myList)
41  print *, "number of para elements: ", nels
42  print *, "Dumping pure text under them..."
43  do i = 0, nels - 1
44     n => item(myList,i)
45     childList => getChildNodes(n)
46     do j = 0, getLength(childList) - 1
47        n => item(childList,j)
48        if (getNodeType(n) == TEXT_NODE) then
49           s = getNodeValue(n)
50           print *, "|", char(s), "|"
51        endif
52     enddo
53  enddo
54
55
56end program text
Note: See TracBrowser for help on using the repository browser.