Open NicSAE opened 5 years ago
@NicSAE
Thank you very much for pointing it out, I'll try to investigate end fix the bug as fast as I can.
@NicSAE
I have just pushed a new release that seems to fix the bug: analyzing your test I found that aside the main bug into the content
method there was also a bug into the search
method. Now both bugs should be fixed. I added a new input for raising the bug on the search
method (that is called when a nested content is searched for).
Let me know if this new release works for your application.
Cheers.
Dear szaghi,
There still seems to be a problem. I have to extract information from a nested XML file, and maybe it is me getting FoXy wrong and stepping down the levels in a too complicated way. If this is the case, sorry for bothering you (but please, could you point me to an example on how to parse nested XML in the correct way?)!
Everything works fine when I compile with gfortran 7.4.0 or ifort 18.0.5 w/o any debugging options or optimization. But when I switch bound checking on, the code breaks with an error, here for "gfortran -g -fbounds-check -fbacktrace", with similar output for ifort:
_At line 224 of file foxy_xmltag.F90 Fortran runtime error: Substring out of bounds: lower bound (0) of 'source' is less than one
This happens for the second entry in the xml-file, no matter if it is parsed first or second. The example code will always break when scanning for "magnitude", no matter if "origin" is - succesfully - parsed before. If you interchange magnitude and origin, in the XML, it will break for "origin".
simplified_quakeml_test.tar.gz
Thank you very much, first of all for providing this very helpful library!
========== Some background, not relevant for the bug report, but maybe of interest: FoXy should allow our Fortran90 tsunami simulation code to parse QuakeML, a standard to describe earthquake events, without any python wrapper or such. We need the magnitude and the epicentre longitude and latitude, later also the fault mechanism. The full example I am trying to parse (scroll until QuakeML): https://github.com/usgs/Quakeml/wiki/Focal-mechanism-example
GitHubANSS Quakeml. Contribute to usgs/Quakeml development by creating an account on GitHub.
w/o any debugging options or optimization. Not well formulated: I meant: (w/o any debugging options) or (optimization). FoXy compiled with optimization, e.g., -O3, also works fine and we can extract all values we need.
I am trying to parse a simple xml file, based on the one you use in the "parse_file_simple" test case.
It seems to me that calling xml_file%parse gives satisfying results only when you're trying to acces the content of the first tag.
To demonstrate this, I have created 3 simple xml files (input_light_1/2/3.xml), that contain only 3 tags, "first", "second", "third", but placed in different orders. I also wrote a minimal fortran code (parse_file_simple_LIGHT.f90), that takes a single xml file as an argument, and attends to access the content of tags "first", "second", and "third" and prints result.
You can find every file in the enclosed archive.
Any help would be greatly appreciated. FOXY_TEST_CASE.tar.gz