Closed qg020 closed 4 weeks ago
Does the parsing stop because an exception is raised by the parser? In that case I can add an option to continue parsing and not stop by raising an error.
Also, have you verified your ARXML file against the schema file before trying to parse? I always use xmllint tool to verify any XML file first. I always check against schema versions 48, 49, 50 and 51. If your ARXML uses any other version I cannot give any support.
Finally, the new code base is still in early development. I haven't tried it myself yet to parse any XML generated by other tool or script. I will start testing it later, somewhere after v0.5.4.
Hi cogu, thanks for the response. ARXML input files mention r4.0 AUTOSAR_4-2-2. The problem is definitely in our ARMXL which have duplicate entries. All errors reported by the Reader indicate that. Which is great. Just a convenience thing if you could ask to see all the parsing problems at once.
Low hanging fruit for when you have time (haha). Thanks!
When I have time I plan to add a boolean flag to the reader class named something like "stop_on_error" which defaults to True. Manually setting it to False should get the effect you want.
But before I can add that I have to refactor all the places in the Reader code that raises an exception to only print a warning based on this flag. It's gonna take some time to do.
Hi Conny,
Thank you for giving this some thought and committing to add it. If you don't mind, I'll take a crack at making the changes you propose and see if I can make progress.
-r
On Fri, Mar 29, 2024 at 6:31 AM Conny Gustafsson @.***> wrote:
When I have time I plan to add a boolean flag to the reader class named something like "stop_on_error" which defaults to True. Manually setting it to False should get the effect you want.
But before I can add that I have to refactor all the places in the Reader code that raises an exception to only print a warning based on this flag. It's gonna take some time to do.
— Reply to this email directly, view it on GitHub https://github.com/cogu/autosar/issues/103#issuecomment-2027249352, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHVSC3A56QGZIZWRLAYJS3Y2VNLXAVCNFSM6AAAAABDIZGUW6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRXGI2DSMZVGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@rcd09, Actually when I think about it I would prefer to keep most of the exceptions and instead catch them in a try-except block in the method _read_package_elements
.
package.append(element)
inside _read_package_elements
will raise an exception instead, which we can catch in the same place.I can make the change to the _read_package_elements
. It should be a quick fix.
@qg020, @rcd09, I've made a first attempt of the change on latest master. There is still a lot of improvements that can be made but it should be good enough for now.
I decided to let stop_on_error be False as default. Now you have to explicitly set it to True to stop reading the XML.
See print_errors.py example with an invalid ARXML containing duplicates.
I am reading ARXML we have generated and it is not to the Reader's liking. I have iterated through fixing each raised exception. A nice feature would be a 'parse-only' flag that would return a list of all lines in an ARXML file needing attention and why it is a problem.