
Dear fellow developers, I originally posted my questions on stackoverflow: http://stackoverflow.com/questions/9265534/how-to-customize-namespace-prefix... objects-inheriting-from-lxml-elementbase I understand that custom XML elements should inherit from `ElementBase`. For instance, I can create class FactVariable(etree.ElementBase): ''' Class that represents a XBRL fact variable.''' TAG = '{http://xbrl.org/2008/variable}factVariable' @property def label(self): return self.attrib['{http://www.w3.org/1999/xlink}label'] @label.setter def label(self, value): self.attrib['{http://www.w3.org/1999/xlink}label'] = value My problem is that when I create a XML tree and place such nodes, I get <ns0:factVariable xmlns:ns0="http://xbrl.org/2008/variable" label="azerty"/> **Question**: I want the namespace to be prefixed `va`, not `ns0` How can I change that? I tried to set the `self.nsmap` property, but I have a "read-only" exception. Adding a key/value has no effect (as said in the documentation). I also tried, without success etree.register_namespace('va', 'http://xbrl.org/2008/variable') Thanks in advance Régis