FDOM

The FDOM is a DOM level 1.0 implementation written in F95. There are two "gotchas" that the Fortran programmer should be aware of, and I can't stress either strongly enough. Firstly the DOM, like many programming languages, starts counting from 0, and not 1, for this reason all do loops should run from 0 to length - 1. Secondly, we while we can not return an object in Fortran per se, we can return a pointer to an arbitrary structure containing mulitple members, including substructures (which is very much like returning an object). Therefore, you must use the pointer syntax:

program main

 use flib_dom
 
 type(fnode), pointer :: object
 type(fnode), pointer :: myNode
 
 object => getParentNode(myNode)
 

and not

program main

 use flib_dom
 
 type(fnode) :: object
 type(fnode) :: myNode
 
 object = getParentNode(myNode)
 

I can anticipate that these two issues (over running lists by counting beyond the last item and trying to assign a pointer with =) will be the cause of most programming errors using FDOM. But fairly soon you get used to it, if you already program in other languages, or already use pointers in Fortran there shouldn't be any problem at all.

Here is a list of the the methods implemented:


(Generic) Node Interface

element Node Interface

document Node Interface

attribute Node Interface

nodeList Interface

namedNodeMap Interface




A partial list of the interfaces of the methods implemented follows. For a full listing, please see the code in subdirectory dom of the main distribution.