Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use human-readable XPath in XMLLocation #121

Open
andreaskern74 opened this issue Nov 15, 2024 · 0 comments
Open

Use human-readable XPath in XMLLocation #121

andreaskern74 opened this issue Nov 15, 2024 · 0 comments
Labels
isState:New A new issue that needs to be classified to a type. isType:Feature An issue that adds new features to the project.
Milestone

Comments

@andreaskern74
Copy link
Collaborator

andreaskern74 commented Nov 15, 2024

Is your feature request related to a problem? Please describe.

When checking the file tests/data/examples/Ex_Entry_Exit.xodr, one of the Issue locations may look like

<Locations description="description">
  <XMLLocation xpath="/OpenDRIVE/road[1]/lanes/laneSection[2]/right/lane[3]"/>
  <FileLocation column="0" row="282"/>
</Locations>

Explanation of the XPath value:

  • first road element in XODR
  • second laneSection entry in this road
  • third right lane entry in this lane section

With the <FileLocation/>, it is possible to look into the source code, and find more details. With them it is possible to find this element in third-party tools, which are noch integrated in the product. But this is slow and annoying.

Describe the solution you'd like

The following XPath would be much better understandable from human perspective and it is still resolvable by the result pooling to calculate the <FileLocation/> entry.

<XMLLocation xpath="/OpenDRIVE/road[@id='308']/lanes/laneSection[@s='5.8000000000000000e+01']/right/lane[@id='-3']"/>

Describe alternatives you've considered

The path is calculated by the standard Python function etree.ElementTree.getpath(), which can not be adapted. So, we need a helper function which creates the human-readable version of the XPath by accessing the original element and replacing the index values in the XPath with attributes values. Base could be a mapping table defining the relevant attribute, which should be used.

road --> id
laneSection --> s
lane --> id
roadMark --> sOffset
elevation --> s
superelevation --> s
geometry --> s

Only needed for elements, which may occur multiple times in a row. In case we forget an entry in the table, we can still use the index here. But we have then the most important element locations in a human-readable format.

Additional context

  • We need also a check if that the new generated XPath points still to the original one.
  • Also interesting for OpenSCENARIO XML with another element name / index attribute mapping
@andreaskern74 andreaskern74 added isType:Feature An issue that adds new features to the project. isState:New A new issue that needs to be classified to a type. labels Nov 15, 2024
@AsamDiegoSanchez AsamDiegoSanchez added this to the Wishlist milestone Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
isState:New A new issue that needs to be classified to a type. isType:Feature An issue that adds new features to the project.
Projects
None yet
Development

No branches or pull requests

2 participants