1 # Copyright (C) 2002, Peter Roozemaal.
3 # GnuCoMo/CoConf is free software; you may redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2, or (at your option)
6 # any later version. See the file COPYING.
9 from xml.dom.minidom import parse, Document
11 _id = "$Id: coxmlfile.py,v 1.1 2002-11-19 19:21:18 arjen Exp $"
14 return node.nodeType == node.TEXT_NODE and string.strip(node.data) == ""
16 # NOTE: the normalise function doesn't work under python 2.0.
17 def normalise(xmlnode):
18 "We strip blanks-only text nodes"
19 child = xmlnode.firstChild
23 child = child.nextSibling
24 xmlnode.removeChild(remove)
27 if child.hasChildNodes():
29 child = child.nextSibling
32 def load_from_file(filename):
33 file = open(filename, "r")
36 # return normalise(dom)
39 def save_to_file(dom, filename):
40 file = open(filename, "w")