[Documentation] [TitleIndex] [WordIndex

TinyXML is a simple, small, C++ XML parser that can be integrating into other programs. It is the standard XML parser for ROS. TinyXML is installed as a system dependency, meaning it is not a ROS package and requires some custom CMake code to compile against.

Using the system install version with Catkin

TinyXML does not install a FindTinyXML.cmake file on its own, instead a custom one must be provided. To save ROS developers time and centralize custom *.cmake modules commonly used in ROS, a new catkin package named [cmake_modules](https://github.com/ros/cmake_modules) has been created to aid in including these cmake files. The following steps will instruct you in how to easily use TinyXML with a custom CMake file in ROS.

#includes

To use the system dependency of tinyxml, add to your code:

#include <tinyxml.h>

CMakeLists.txt

The custom cmake file is included by depending on cmake_modules. Make sure you have cmake_modules and TinyXML including in the following places in your CMakeLists.txt:

  # Load catkin and all dependencies required for this package                                                                                              
  find_package(catkin REQUIRED
    cmake_modules
    ...
  )

  find_package(TinyXML REQUIRED)

  # Declare a catkin package                                                                                                                                
  catkin_package(
    LIBRARIES
      ...
    INCLUDE_DIRS
      include
    DEPENDS
      TinyXML
  )

  # Build                                                                                                                                                   
  include_directories(include ${catkin_INCLUDE_DIRS} ${TinyXML_INCLUDE_DIRS})

Then for every library/executable that uses TinyXML, be sure to link libraries:

  target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${TinyXML_LIBRARIES})

package.xml dependencies

Add to your package.xml:

<build_depend>tinyxml</build_depend>
<build_depend>cmake_modules</build_depend>

<run_depend>tinyxml</run_depend>

External Documentation

Please see the tinyxml website for documentation on using tinyxml.


2022-05-28 13:05