Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
33
Task/XML-Input/Fortran/xml-input-1.f
Normal file
33
Task/XML-Input/Fortran/xml-input-1.f
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
program tixi_rosetta
|
||||
use tixi
|
||||
implicit none
|
||||
integer :: i
|
||||
character (len=100) :: xml_file_name
|
||||
integer :: handle
|
||||
integer :: error
|
||||
character(len=100) :: name, xml_attr
|
||||
xml_file_name = 'rosetta.xml'
|
||||
|
||||
call tixi_open_document( xml_file_name, handle, error )
|
||||
i = 1
|
||||
do
|
||||
xml_attr = '/Students/Student['//int2char(i)//']'
|
||||
call tixi_get_text_attribute( handle, xml_attr,'Name', name, error )
|
||||
if(error /= 0) exit
|
||||
write(*,*) name
|
||||
i = i + 1
|
||||
enddo
|
||||
|
||||
call tixi_close_document( handle, error )
|
||||
|
||||
contains
|
||||
|
||||
function int2char(i) result(res)
|
||||
character(:),allocatable :: res
|
||||
integer,intent(in) :: i
|
||||
character(range(i)+2) :: tmp
|
||||
write(tmp,'(i0)') i
|
||||
res = trim(tmp)
|
||||
end function int2char
|
||||
|
||||
end program tixi_rosetta
|
||||
29
Task/XML-Input/Fortran/xml-input-2.f
Normal file
29
Task/XML-Input/Fortran/xml-input-2.f
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
program fox_rosetta
|
||||
use FoX_dom
|
||||
use FoX_sax
|
||||
implicit none
|
||||
integer :: i
|
||||
type(Node), pointer :: doc => null()
|
||||
type(Node), pointer :: p1 => null()
|
||||
type(Node), pointer :: p2 => null()
|
||||
type(NodeList), pointer :: pointList => null()
|
||||
character(len=100) :: name
|
||||
|
||||
doc => parseFile("rosetta.xml")
|
||||
if(.not. associated(doc)) stop "error doc"
|
||||
|
||||
p1 => item(getElementsByTagName(doc, "Students"), 0)
|
||||
if(.not. associated(p1)) stop "error p1"
|
||||
! write(*,*) getNodeName(p1)
|
||||
|
||||
pointList => getElementsByTagname(p1, "Student")
|
||||
! write(*,*) getLength(pointList), "Student elements"
|
||||
|
||||
do i = 0, getLength(pointList) - 1
|
||||
p2 => item(pointList, i)
|
||||
call extractDataAttribute(p2, "Name", name)
|
||||
write(*,*) name
|
||||
enddo
|
||||
|
||||
call destroy(doc)
|
||||
end program fox_rosetta
|
||||
Loading…
Add table
Add a link
Reference in a new issue