import sys
import amara
from amara.lib.util import element_subtree_iter
from amara.xpath.util import abspath
doc = amara.parse(sys.argv[1])
top_prefixes = dict(doc.xml_select('*')[0].xml_namespaces)
for e in element_subtree_iter(doc):
print abspath(e, prefixes=top_prefixes)
attrs = dict(e.xml_attributes)
if attrs:
print '\t', attrs
/xbel
{(None, u'version'): u'1.0'}
/xbel/title
/xbel/folder
{(None, u'folded'): u'yes'}
/xbel/folder[2]
{(None, u'folded'): u'yes'}
/xbel/folder[2]/title
/xbel/folder[2]/bookmark
Pretty easy to tweak or format and details of report, etc.
In the example above I pass along a URL. You can also pass along a file name, if you like.