Bug #804

Etree output files use names like ns0 and ns1 not their default names

Added by Joseph Perry over 11 years ago. Updated almost 9 years ago.

Status:VerifiedStart date:
Priority:MediumDue date:
Assignee:Joseph Perry% Done:

0%

Category:-
Target version:Release 0.7
Google Code Legacy ID:archivematica-149 Pull Request:
Sponsored: Requires documentation:

Description

The following web page has a solution to this:
http://blogs.nuxeo.com/dev/2006/02/elementtree-serialization-namespace-prefixes.html

[[ >>> my_namespaces = {'http://foo' : 'foo',

...                  'http://bar/' : bar}
>>> elementtree.ElementTree._namespace_map.update(my_namespaces)
]]

However:
ImportError: No module named elementtree.ElementTree

History

#1 Updated by Anonymous over 11 years ago

What implementation of ElementTree are you using, and what version of Python? It seems the XML scripts are all using xml.etree.cElementTree.

See the following: http://effbot.org/zone/element-namespaces.htm#element-tree-representation

"Adding global namespaces for older versions of cElementTree is a bit tricker; that library uses the ElementTree library for serialization, so you have to import the corresponding ElementTree version and modify its _namespace_map instead. cElementTree 1.0.6 and later provides a register_namespace function that does the right thing."

#2 Updated by Austin Trask about 11 years ago

maybe this will help:
http://fingergeek.blogspot.com/2009/06/python-elementtree-fix-for-ubuntu.html

first python-elementtree needs to be added to archivematica dependencies

then for ubuntu instead of import elementtree, use
import xml.etree.ElementTree

#3 Updated by Anonymous about 11 years ago

xml.etree.ElementTree is the version of ElementTree included in the standard library in Python versions 2.5 and higher; see http://docs.python.org/library/xml.etree.elementtree.html

#4 Updated by Joseph Perry almost 11 years ago

Problem solved using updated version of lxml.
sudo apt-get install python-lxml

#5 Updated by Joseph Perry almost 11 years ago

  • Status changed from New to Verified

Also available in: Atom PDF