[1960] | 1 | program 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 | |
---|
| 56 | end program text |
---|