Home | Tutorials | Wiki | Issues
Ask Your Question

Tools to validate SDF files with

asked 2017-02-23 01:24:17 -0600

9a3eedi gravatar image


I'm following the Gazebo tutorials on making a model. I decided to manually write the SDF file instead of copy pasting from the tutorial, so that I would learn better. I am now attempting to load the file in Gazebo and I get the following error:

Error [parser.cc:292] Error parsing XML in file [/home/mkhoory/gazebo/models/box.sdf]: Error reading end tag.
[Err] [Server.cc:391] Unable to read sdf file[models/box.sdf]

My question is: is there a tool I can use to validate the SDF file? I can't seem to find anyone mentioning any tool, and the error message from gazebo is unhelpful because it doesn't give me a line number in the very least.

Really all I want is the line number of where the problem is for when I load it with gazebo.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-03-01 00:51:47 -0600

9a3eedi gravatar image

updated 2017-03-01 00:53:06 -0600

I found a useful tool (xmllint) to make sure all of my SDF file are valid. It's actually a general tool for XML files, so it also works for config files for example.

Just run, for example:

xmllint ~/.gazebo/models/ground_plane/model.sdf

If you just get the content of the file as output, then your SDF file is valid, otherwise you'd get errors.

It helps a lot. But I still run into issues that are specific to SDF files, so if there's a better tool it'll be great.

edit flag offensive delete link more

answered 2017-02-23 09:18:35 -0600

Gazebo comes with a command line tool gz sdf which you can use to check SDF files, for example:

gz sdf -k ~/.gazebo/models/ground_plane/model.sdf

Unfortunately, the error message is the same you're seeing there, which is not very helpful. I ticketed an issue about this.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-02-23 01:24:17 -0600

Seen: 1,142 times

Last updated: Mar 01 '17