Re: Remove namespace declaration from ElementTree in lxml

2007-12-29 Thread Stefan Behnel
Zero Piraeus wrote: >> You can try this: >> >>root = etree.parse(...).getroot() >>new_root = etree.Element(root.tag, root.attrib) >>new_root[:] = root[:] >> >> Note, however, that this will not copy root-level PIs or internal DTD >> subsets. >> But you can copy PIs and comments by hand

Re: Remove namespace declaration from ElementTree in lxml

2007-12-28 Thread Zero Piraeus
: > > I want to remove an unused namespace declaration from the root element > > of an ElementTree in lxml. > > > [...] I'm reduced to sticking the output through str.replace() ... > > which is somewhat inelegant. > > And also a bit error prone (unless you are sure the replaced string really > onl

Re: Remove namespace declaration from ElementTree in lxml

2007-12-28 Thread Stefan Behnel
Zero Piraeus wrote: > I want to remove an unused namespace declaration from the root element > of an ElementTree in lxml. > > There doesn't seem to be any documented way to do this, so at the > moment I'm reduced to sticking the output through str.replace() ... > which is somewhat inelegant. And

Remove namespace declaration from ElementTree in lxml

2007-12-27 Thread Zero Piraeus
: I want to remove an unused namespace declaration from the root element of an ElementTree in lxml. There doesn't seem to be any documented way to do this, so at the moment I'm reduced to sticking the output through str.replace() ... which is somewhat inelegant. Is there a better way? -[]z. --