-
Notifications
You must be signed in to change notification settings - Fork 103
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
Fix whitespace preservation behavior with TinyXML2 #359
Conversation
This addresses a change in how whitespace is preserved/collapsed between tinyxml and tinyxml2. The change primarily impacts SDF files that have newlines, which is frequently done for aesthetics with include uris. In this case, we use an alternate constructor for TinyXML2 that will collapse whitespace by default. Note that there is a performance impact of this behavior, which causes the parsing to run essentially twice. More information on the behavior may be found here: https://leethomason.github.io/tinyxml2/ Closes #322 Signed-off-by: Michael Carroll <michael@openrobotics.org>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Codecov Report
@@ Coverage Diff @@
## sdf10 #359 +/- ##
=======================================
Coverage 87.32% 87.32%
=======================================
Files 60 60
Lines 9214 9216 +2
=======================================
+ Hits 8046 8048 +2
Misses 1168 1168
Continue to review full report at Codecov.
|
I'm going to test a narrower approach that calls |
This copies the whitespace test from gazebosim#359 but takes a narrower approach by only trimming whitespace from `<uri>` element text. Closes gazebosim#322. Signed-off-by: Steve Peters <scpeters@openrobotics.org>
narrower approach in #365 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the right approach. I'll close #365
@osrf-jenkins run tests please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to make the same changes in the URDF parser (src/parser_urdf.cc
)?
I don't believe so, because my understanding was that URDF only uses attributes in tags, versus the actual content of tags:
Is that correct? |
I think you're right about that, but if the URDF contains Gazebo extensions (eg. https://answers.gazebosim.org//question/7082/using-sdf-tags-in-urdf-gazebo-extension-directly/), it could have values in tags. |
Failed to account for that. I will update and add a test for it. |
Signed-off-by: Michael Carroll <michael@openrobotics.org>
I added a test case in 2721714, it actually didn't require any adjustment for me in the actual URDF parser. I think this is because we trim the values that we parse from URDF in the process of changing to SDF. In the case of this test, the
And then
|
Signed-off-by: Michael Carroll <michael@openrobotics.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! And thanks for adding the URDF Test.
This addresses a change in how whitespace is preserved/collapsed between tinyxml and tinyxml2. The change primarily impacts SDF files that have newlines, which is frequently done for aesthetics with include uris. In this case, we use an alternate constructor for TinyXML2 that will collapse whitespace by default. Note that there is a performance impact of this behavior, which causes the parsing to run essentially twice. More information on the behavior may be found here: https://leethomason.github.io/tinyxml2/ Closes gazebosim#322 Signed-off-by: Michael Carroll <michael@openrobotics.org> Co-authored-by: Steve Peters <scpeters@openrobotics.org>
This addresses a change in how whitespace is preserved/collapsed between tinyxml and tinyxml2. The change primarily impacts SDF files that have newlines, which is frequently done for aesthetics with include uris. In this case, we use an alternate constructor for TinyXML2 that will collapse whitespace by default. Note that there is a performance impact of this behavior, which causes the parsing to run essentially twice. More information on the behavior may be found here: https://leethomason.github.io/tinyxml2/ Closes #322 Signed-off-by: Michael Carroll <michael@openrobotics.org> Co-authored-by: Steve Peters <scpeters@openrobotics.org>
This addresses a change in how whitespace is preserved/collapsed between tinyxml and tinyxml2. The change primarily impacts SDF files that have newlines, which is frequently done for aesthetics with include uris. In this case, we use an alternate constructor for TinyXML2 that will collapse whitespace by default. Note that there is a performance impact of this behavior, which causes the parsing to run essentially twice. More information on the behavior may be found here: https://leethomason.github.io/tinyxml2/ Closes #322 Signed-off-by: Michael Carroll <michael@openrobotics.org> Co-authored-by: Steve Peters <scpeters@openrobotics.org>
This addresses a change in how whitespace is preserved/collapsed between
tinyxml and tinyxml2. The change primarily impacts SDF files that have
newlines, which is frequently done for aesthetics with include uris.
In this case, we use an alternate constructor for TinyXML2 that will
collapse whitespace by default.
Note that there is a performance impact of this behavior, which causes
the parsing to run essentially twice.
More information on the behavior may be found here: https://leethomason.github.io/tinyxml2/
Closes #322
Signed-off-by: Michael Carroll michael@openrobotics.org