def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False, win32=False):
 xml_string = XmlToString(content, encoding, pretty)
 if (win32 and (os.linesep != '\r\n')):
  xml_string = xml_string.replace('\n', '\r\n')
 try:
  xml_string = xml_string.encode(encoding)
 except Exception:
  xml_string = unicode(xml_string, 'latin-1').encode(encoding)
 try:
  f = open(path, 'r')
  existing = f.read()
  f.close()
 except:
  existing = None
 if (existing != xml_string):
  f = open(path, 'w')
  f.write(xml_string)
  f.close()

def WriteXmlIfChanged ( content , path , encoding = 'utf-8' , pretty = False , win32 = False ) : xml_string = XmlToString ( content , encoding , pretty ) if ( win32 and ( os . linesep != '\r\n' ) ) : xml_string = xml_string . replace ( '\n' , '\r\n' ) try : xml_string = xml_string . encode ( encoding ) except Exception : xml_string = unicode ( xml_string , 'latin-1' ) . encode ( encoding ) try : f = open ( path , 'r' ) existing = f . read ( ) f . close ( ) except : existing = None if ( existing != xml_string ) : f = open ( path , 'w' ) f . write ( xml_string ) f . close ( )
writes the xml content to disk .