Danny Scalenotti wrote: > I'm not able to get out of this ....... > > > from xml.dom.minidom import getDOMImplementation > > impl = getDOMImplementation() // default UTF-8 > doc = impl.createDocument(None, "test",None) > root = doc.documentElement
Here, you're actually getting a reference to the root "test" element at the top of the document. > root.setAttribute('myattrib', '5') > > print root.toxml() Here, you're serialising the root "test" element, not the whole document. > I obtain > > <test myattrib="5"/> ...which is the expected result. > why not this? > > <?xml version="1.0" encoding="UTF-8"?> > <test myattrib="5"/> Because you need to do this: print doc.toxml() Paul -- http://mail.python.org/mailman/listinfo/python-list