parameters: (content, path, encoding='utf-8', pretty=False,
                        win32=False)
docstring: Writes the XML content to disk, touching the file only if it has changed.
  
    Args:
      content:  The structured content to be written.
      path: Location of the file.
      encoding: The encoding to report on the first line of the XML file.
      pretty: True if we want pretty printing with indents and new lines.
docstring_summary: Writes the XML content to disk, touching the file only if it has changed.
docstring_tokens: Writes the XML content to disk touching the file only if it has changed .
function: def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False,
                        win32=False):
    """ Writes the XML content to disk, touching the file only if it has changed.
  
    Args:
      content:  The structured content to be written.
      path: Location of the file.
      encoding: The encoding to report on the first line of the XML file.
      pretty: True if we want pretty printing with indents and new lines.
    """
    xml_string = XmlToString(content, encoding, pretty)
    if win32 and os.linesep != '\r\n':
      xml_string = xml_string.replace('\n', '\r\n')
  
    default_encoding = locale.getdefaultlocale()[1]
    if default_encoding.upper() != encoding.upper():
      xml_string = xml_string.decode(default_encoding).encode(encoding)
  
    # Get the old content
    try:
      f = open(path, 'r')
      existing = f.read()
      f.close()
    except:
      existing = None
  
    # It has changed, write it
    if existing != xml_string:
      f = open(path, 'w')
      f.write(xml_string)
      f.close()
function_tokens: 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' ) default_encoding = locale . getdefaultlocale ( ) [ 1 ] if default_encoding . upper ( ) != encoding . upper ( ) : xml_string = xml_string . decode ( default_encoding ) . encode ( encoding ) # Get the old content try : f = open ( path , 'r' ) existing = f . read ( ) f . close ( ) except : existing = None # It has changed, write it if existing != xml_string : f = open ( path , 'w' ) f . write ( xml_string ) f . close ( )