https://nn-online.org

16 December 2024

info@nn-online.org

XML

Last updated 8 January 2006

The code is provided as is, you can use it as you wish. But I would appreciate it if you'd let me know if you find a particularly useful purpose for it - I might make some kind of gallery. Feedback, suggestions and contributions to improve this software are more than welcome; if you have any questions, remarks, bug fixes, donations, postcards, or job offers, please contact me: info@nn-online.org

This is an attempt to write a module that reads and interprets XML in standard fortran 95 without the need to interface to other languages. While it has been suggested to use other languages that are 'more suitable' for this job, or even worse, use .NET as an alternative, I prefer to use fortran solutions whenever possible, and thus also for parsing XML.

The code as it currently is is already quite able to parse XML, but has some limitations. I had hoped to resolve those first before releasing code, but other priorities kept me from working on it. Next couple of months (September - December 2003) I will most likely be able to spend a considerable amount of time on it. However the request for XML parsing in fortran regulary pops up in comp.lang.fortran and I decided to release the code as it is right now anyway. To some people it may already be useful and feedback from users will help its further development.

The main limitations I can think of right now are: Apart from this there surely are other issues; error reporting is obscure and documentation is lacking.

How does it work?

The package has a test program and a test input file that gives an impression. As input you need to have the XML file as well as a handler routine (4 examples are provided). When the parser encounters something useful in the XML file it will send that to the handler routine which will (not surprisingly) handle it. This allows you, the user, to supply a handler routine taylored to whatever you want to use the XML file for. (At the moment feedback from the handler to the parser is not yet implemented). This approach is inspired by SAX. One of the handlers supplied places the information in the XML file into one big tree structure (DOM inspired) and at the end prints it. This tree structure then can be used by your application (a decent API is still lacking, also on the to do list, but the main thing, to put it all in the tree, is working).

As you can see it's still embryonic, but quite promising. Two other initiatives to to write an XML parser in fortran are:

Download: xml-0.4.tar.gz xml-0.4.zip


http://nn-online.org 16 December 2024 info@nn-online.org