[4suite] Namespace bug in 4DOM (Pretty)Print ?
Uche Ogbuji
uche.ogbuji at fourthought.com
Tue Sep 19 11:05:25 MDT 2000
Note that I've fixed this and other such situations to now give a
namespace exception, but I also wanted to point something important out.
> I have a problem in (the old version of) Print / PrettyPrint regarding
> attributes and namespaces:
>
> >>> from xml.dom.ext.reader import Sax2
> >>> from xml.dom.ext import PrettyPrint
> >>> d=Sax2.FromXml('<doc/>')
> >>> e = d.createElement('elt')
^^^
> >>> d.documentElement.appendChild(e)
> >>> e.setAttributeNS('http://logilab','att','value1')
^^^^
Bad idea. DOM L2 reluctantly allows mixing NS and non-NS code for
strict backward compatability, but they point out that it's very bad
practice to do so. If you're using NS functions, use _only_ NS
functions. If you're using non-NS functions, use only non-NS
functions. So you should either be using createElementNS above, or
setAttribute. You shouldn't mix the forms within a single document.
It's strictly correct, but you'll have some weird effects.
--
Uche Ogbuji Principal Consultant
uche.ogbuji at fourthought.com +1 303 583 9900 x 101
Fourthought, Inc. http://Fourthought.com
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python
More information about the 4suite
mailing list