On 05.03.06 13:00:49, Stefan Behnel wrote:
Andreas Pakulat wrote:
regarding the remove-redundant-namespaces issue there are news:
kbuchcik implemented the xmlDOMWrapReconcileNamespaces in tree.c of libxml2 so it should remove redundant NS decl. However neither do I have any experience with libxml2 nor do I have the time to dig into it so that I can build a test program for this.
Thus I ask you guys here, who surely are libxml2 experts, if you could help me out here. Either some "hack" for lxml that allows me to test this or a small programm that takes an xml file and applies this function to it's DOM tree (and outputs the result) would be really great.
Hi,
Here is a trivial patch that simply calls the function after having copied an element between documents.
If I understand that correctly it should also work if I create a new Element (with a namespace) and insert it as child right? If that is correct, than this doesn't help. I still get a an extra ns declaration:
print etree.tostring(tree) <elem xmlns="test"><subelem/></elem> [25296 refs] tree.append(etree.Element("{test}sub1")) [25296 refs] print etree.tostring(tree) <elem xmlns="test"><subelem/><ns0:sub1 xmlns:ns0="test"/></elem> [25296 refs] tree.append(etree.Element("{test}sub2")) [25296 refs] print etree.tostring(tree) <elem xmlns="test"><subelem/><ns0:sub1 xmlns:ns0="test"/><ns0:sub2 xmlns:ns0="test"/></elem>
BTW: Stefan, the setup.py was correct in using xslt-config to get the compiling parameters which of course is part of libxslt, which I first forgot (and that's also why I got the missing function when importing). Andreas -- You will be misunderstood by everyone.