gazebosim / gazebosim/sdformat

RFC: Convert xmlschema.rb to c++

Open
#118 4 comments 0 reactions 0 assignees View on GitHub
good first issue help wanted minor proposal
Dominant language
C++
Stars
216
Forks
125
Avg merge
1d 14h
Merged PRs (30d)
14

Description

**Original report ([archived issue](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/issues/118)) by Rich Mattes (Bitbucket: [richmattes](https://bitbucket.org/%7B1ef6f3dd-b8db-412b-94e9-e430e7aafd23%7D/)).**

----------------------------------------
I had some spare time a few months ago and managed to convert xmlschema.rb to c++ using tinyxml. I was wondering if there's any interest from you guys in supporting such a switch.

The tinyxml-based C++ xmlschema is basically a line-for-line port of the existing ruby script to C++. It provides the following:

Benefits:

* No build-time dependency on ruby (might be nice for Windows)
* Runs faster than the ruby schema generator

Drawbacks:

* Lose dynamic features ruby provides
* Whitespace in CDATA (descriptions) isn't preserved when converting from .sdf files

The lossy treatment of whitespace seems to be a [well-known](http://stackoverflow.com/questions/11450442/multiple-whitespaces-removed-from-xml-when-they-should-not-be) attribute of tinyxml, and they recommend that tinyxml2 should be used instead (in general, and also because of the whitespace handling.)

I ended up making a second version of xmlschema using tinyxml2, and was able to get identical output to the ruby scripts. It wasn't terribly difficult to go from tinyxml->tinyxml2, but using a different version of tinyxml than sdformat uses seemed to be kind of silly, and I didn't have enough time to try to port sdformat to tinyxml2.

If there's interest in either or both versions of the code I'll clean it up and create PRs, otherwise you can go ahead and close this bug.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.