Ask Your Question
1

Unbound prefix error in xarco file

asked 2013-08-20 08:12:12 -0600

munnveed gravatar image

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

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

gvdhoorn gravatar image

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

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 image130s ( 2015-06-27 06:46:46 -0600 )edit
1

Typos are always the hardest to spot.

gvdhoorn gravatar imagegvdhoorn ( 2015-06-27 09:08:24 -0600 )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 imagefvd ( 2018-08-30 21:32:45 -0600 )edit
0

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-08-20 08:12:12 -0600

Seen: 1,455 times

Last updated: Jun 28 '15