> I guess the easiest way is to linearise it, then parse it again. If it > is 4DOM, you can use xml.dom.ext.Printer for the linearisation. interesting question: can you invoke DOM methods such that the resultant structure is invalid? Off the top of my head, I don't know.