'XML file is not DOM after parsing file Google Drive (google script) [duplicate]

I would like to parse the XML file from Google Drive. Here is my code:

function findFile(ICO){
  var fileName = ICO + '.xml';
  const folderFiles = DriveApp.getFolderById('ID of file').getFiles();
  while (folderFiles.hasNext()) {
    var folderFile = folderFiles.next();
    if(folderFile.getName() == fileName){
      return folderFile.getId();
      break;
    }
  }
}

function filesearch(ICO){
  var fileId = findFile(ICO);
  var fileFound = DriveApp.getFileById(fileId).getBlob().getDataAsString();
  var docXml = XmlService.parse(fileFound);
  return docXml;
}


function getXML(){
  var text_ICO_txt = '27074358';
  docXml = filesearch(text_ICO_txt);
  var root = docXml.getRootElement();
  var kod = docXml.getElementsByTagName("are:Kod");
}

So, I receive the error:

TypeError: docXml.getElementsByTagName is not a function

I guess, it is because docXml is not a DOM. XML file:

<?xml version="1.0" encoding="UTF-8"?>
<are:Ares_odpovedi xmlns:are="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_answer_vreo/v_1.0.0" odpoved_datum_cas="2022-05-09T15:00:10" odpoved_pocet="1" odpoved_typ="Vypis_VREO" vystup_format="XML" xslt="klient" validation_XSLT="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_odpovedi.xsl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_answer_vreo/v_1.0.0 http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_answer_vreo/v_1.0.0/ares_answer_vreo.xsd" Id="ares">
<are:Odpoved>
 <are:Pomocne_ID>0</are:Pomocne_ID>
 <are:Vysledek_hledani>
  <are:Kod>1</are:Kod>
 </are:Vysledek_hledani>
 <are:Pocet_zaznamu>1</are:Pocet_zaznamu>
 <are:Vypis_VREO>
  <are:Uvod>
   <are:Nadpis>Výpis z veřejného rejstříku v ARES - elektronický opis</are:Nadpis>
   <are:Aktualizace_DB>2022-05-09</are:Aktualizace_DB>
   <are:Datum_vypisu>2022-05-09</are:Datum_vypisu>
   <are:Cas_vypisu>15:00:09</are:Cas_vypisu>
   <are:Typ_vypisu>aktualni</are:Typ_vypisu>
  </are:Uvod>
  <are:Zakladni_udaje>
   <are:Rejstrik>OR</are:Rejstrik>
   <are:ICO>27074358</are:ICO>
   <are:ObchodniFirma>Asseco Central Europe, a.s.</are:ObchodniFirma>

So, my aim is to get value of e.g. element are:ObchodniFirma.

Could you, please, help me with it? Thank you in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source