gazebosim/sdformat

RFC: Convert xmlschema.rb to c++

开放

#118 创建于 2016年4月3日

 (4 条评论) (0 个反应) (0 位负责人)C++ (122 个派生)auto 404
good first issuehelp wantedminorproposal

仓库指标

星标
 (216 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Original report (archived issue) by Rich Mattes (Bitbucket: richmattes).


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 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.

贡献者指南