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

Converter::Map only maps first of sibling elements #222

Open
scpeters-test opened this issue Nov 15, 2019 · 0 comments
Open

Converter::Map only maps first of sibling elements #222

scpeters-test opened this issue Nov 15, 2019 · 0 comments
Labels
bug Something isn't working major

Comments

@scpeters-test
Copy link
Collaborator

Original report (archived issue) by Steve Peters (Bitbucket: Steven Peters).


The Converter::Map functionality was added to libsdformat9 in pull request #580. It maps values from elements/attributes into other elements/attributes. It is currently limited to only mapping the first of sibling elements of the same type.

For example, consider the following xml from a .convert file:

<map>
  <from name='elemD'>
    <value>d</value>
    <value>D</value>
  </from>
  <to name='elemF'>
    <value>f</value>
    <value>F</value>
  </to>
</map>

that operates on the following xml:

<elemC attrC='C'>
  <elemD>D</elemD>
  <elemD>D</elemD>
  <elemD>d</elemD>
  <elemD>d</elemD>
</elemC>

Currently it only maps the first element, so the output would be the following (all the original elemD elements plus one new elemF element):

<elemC attrC='C'>
  <elemD>D</elemD>
  <elemD>D</elemD>
  <elemD>d</elemD>
  <elemD>d</elemD>
  <elemF>F</elemF>
</elemC>

I've added a failing test to the following branch that expects all sibling elements to be mapped in the converted xml:

@scpeters-test scpeters-test added major bug Something isn't working labels Mar 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

0 participants