def LoadDocument(self, distfile_xml):
    """Load an entire distfile XML document and parse it.

    Args:
      distfile_xml: str, xml document
    Raises:
      DocumentFormatError: the XML document is malformed.
    """
    try:
      p = minidom.parseString(distfile_xml)
    except xml.parsers.expat.ExpatError, e:
      raise DocumentFormatError(str(e))

    try:
      l = p.getElementsByTagName('localization')[0]
      s = p.getElementsByTagName('strings')[0]
      cdata = []
      for cn in s.childNodes:
        cdata.append(cn.nodeValue)
      cdata = ''.join(cdata)
    except __HOLE__:
      raise DocumentFormatError

    # TODO(user): intead of regex, parse XML.
    self.restart_required = re.search(
        r'onConclusion=("|\')RequireRestart("|\')', distfile_xml) is not None

    swupd_name_match = re.search(
        r'suDisabledGroupID=("|\')([\w\s\.-]*)("|\')', distfile_xml)
    if swupd_name_match:
      self.softwareupdate_name = swupd_name_match.group(2)

    self._installer_script = self._ParseInstallerScriptString(cdata)

    self.description = self._installer_script.get('SU_DESCRIPTION')
    self.server_comment = self._installer_script.get('SU_SERVERCOMMENT')
    self.title = self._installer_script.get('SU_TITLE')
    self.version = (self._installer_script.get('SU_VERS') or
                    self._installer_script.get('SU_VERSION'))
dataset/ETHPy150Open google/simian/src/simian/mac/common/applesus.py/DistFileDocument.LoadDocument