idaholab/FORCE

[TASK] Replacing ET with TreeStructure for xml parsing

Opened this issue · 2 comments


Issue Description

Is your feature request related to a problem? Please describe.
The exclusive use of xml.etree.ElementTree (ET) in parsing input files may in the future lead to bugs or limit functionality if other non-xml trees are used for input.

Describe the solution you'd like
Replacement of the ET parsing with the broader TreeStructure module in RAVEN (RAVEN/ravenframework/utils/TreeStructure.py) will limit future difficulties. Not all ET functions are available in TreeStructure, and naming of functions differs, so more than a simple find-and-replace will be necessary. One such ET function, used in FORCE/tests/unit-tests/test_heron.py, that has no counterpart in TreeStructure, is ET.fromstring(). This function parses a string with xml formatting into ET structure and is particularly useful for unit tests.

Describe alternatives you've considered


For Change Control Board: Issue Review

This review should occur before any development is performed as a response to this issue.

  • 1. Is it tagged with a type: defect or task?
  • 2. Is it tagged with a priority: critical, normal or minor?
  • 3. If it will impact requirements or requirements tests, is it tagged with requirements?
  • 4. If it is a defect, can it cause wrong results for users? If so an email needs to be sent to the users.
  • 5. Is a rationale provided? (Such as explaining why the improvement is needed or why current code is wrong.)

For Change Control Board: Issue Closure

This review should occur when the issue is imminently going to be closed.

  • 1. If the issue is a defect, is the defect fixed?
  • 2. If the issue is a defect, is the defect tested for in the regression test system? (If not explain why not.)
  • 3. If the issue can impact users, has an email to the users group been written (the email should specify if the defect impacts stable or master)?
  • 4. If the issue is a defect, does it impact the latest release branch? If yes, is there any issue tagged with release (create if needed)?
  • 5. If the issue is being closed without a pull request, has an explanation of why it is being closed been provided?

@caleb-sitton-inl I may not understand fully, but from your description, it sounds like we should continue using ET over TreeStructure so we have access to all the functions provided by ET. It seems to me that we should rather rely on a python native library as much as we can before using an in-house wrapper. Also, it appears that ET seems to be used more widespread throughout RAVEN and HERON.

@PaulTalbot-INL @GabrielSoto-INL Thoughts?

We did discuss this a little on a PR. While using ET is a great way to determine how the XML is used, as we look to use EDDI formats as well (with Workbench for .heron files), we may need to consider the more agnostic approach. I agree, for now ET is just fine.