Use QDom or SAX for writing XML files. It is the best way to do it...