ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Unbound prefix error in xarco file

asked 2013-08-20 08:12:12 -0500

munnveed gravatar image

updated 2013-08-20 08:26:02 -0500

I am getting an unbound prefix error when I try to use an xarco macro. I do have the xmlns:xarco defined however. This is my xarco file:

<?xml version="1.0"?>
<robot xmlns:xacro="[link to xarco wiki]" name="flexible">
  <xacro:macro name="test_macro" >
    <test name="x"/>
  </xacro:macro>

  <xarco:test_macro/>
</robot>

And this is the error I am getting:

Expat parsing error.  Check that:
 - Your XML is correctly formed
 - You have the xacro xmlns declaration: xmlns:xacro="[link to xarco wiki]"

Traceback (most recent call last):
  File "/opt/ros/hydro/share/xacro/xacro.py", line 60, in <module>
    xacro.main()
  File "/opt/ros/hydro/lib/python2.7/dist-packages/xacro/__init__.py", line 571, in main
    doc = parse(f)
  File "/usr/lib/python2.7/xml/dom/minidom.py", line 1920, in parse
    return expatbuilder.parse(file)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 928, in parse
    result = builder.parseFile(file)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 207, in parseFile
    parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: unbound prefix: line 7, column 6

Any help would be appreciated.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-06-27 05:21:41 -0500

gvdhoorn gravatar image

updated 2015-06-28 07:08:21 -0500

There is a typo in the xml in the OP: <xarco:test_macro/> while it should be <xacro:test_macro/>. That could be the cause of the error.

edit flag offensive delete link more

Comments

This is it. Now I feel like I'm a dunderhead here...

130s gravatar image 130s  ( 2015-06-27 06:46:46 -0500 )edit
1

Typos are always the hardest to spot.

gvdhoorn gravatar image gvdhoorn  ( 2015-06-27 09:08:24 -0500 )edit

This is the top Google result, so I'll add: I just had an xacro file give this error because the opening line was <robot name="foo"> instead of <robot xmlns:xacro="http://ros.org/wiki/xacro" name="foo">. Take note.

fvd gravatar image fvd  ( 2018-08-30 21:32:45 -0500 )edit
0

answered 2015-06-26 21:12:57 -0500

130s gravatar image

When I copy-pasted your xacro and tried to load, the same error happens. When I typed all letters it runs. For refenrece here's what I used.

<?xml version="1.0"?>
<robot name="flexible" xmlns:xacro="http://ros.org/wiki/xacro">

  <xacro:macro name="test_macro">
    <test name="x"/>
  </xacro:macro>

  <xacro:test_macro />
</robot>

I haven't gone any further but do you use special character encoding or something?

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-08-20 08:12:12 -0500

Seen: 3,190 times

Last updated: Jun 28 '15