code: def XMLProcessing(transcribe):
      DOMTree = parse(transcribe)
      trans = DOMTree.documentElement
  
      # get audio file information
      if trans.hasAttribute("audio_filename"):
          audio_filename = trans.getAttribute("audio_filename")
      else:
          print("audio_file error for %s" % transcribe)
          return
  
      # get speaker information
      speaker_info = {}
      speakers = trans.getElementsByTagName("Speakers")
      if len(speakers) < 1:
          print("no speaker found, deal individually")
      else:
          speakers = speakers[0]
          for speaker in speakers.childNodes:
              speaker_info[speaker.getAttribute("id")] = {
                  "name": speaker.getAttribute("name"),
                  "dialect": speaker.getAttribute("dialect"),
                  "scope": speaker.getAttribute("scope"),
                  "accent": speaker.getAttribute("accent"),
              }
  
      # process by episode/section/turn/sync
      xml_text = []
      episodes = trans.getElementsByTagName("Episode")
      for episode in episodes:
          sections = episode.getElementsByTagName("Section")
          for section in sections:
              section_list = []
              turns = section.getElementsByTagName("Turn")
              for turn in turns:
                  # read as individual speech
                  raw_speaker = turn.getAttribute("speaker")
                  if len(raw_speaker.split(" ")) > 1:
                      # print("continue in %s" % audio_filename)
                      continue
                  individual_speech = (
                      raw_speaker not in speaker_info.keys()
                  )
  
                  syncs = turn.getElementsByTagName("Sync")
                  comments = turn.getElementsByTagName("Comment")
  
                  # remove comment nodes
                  for child in comments:
                      turn.removeChild(child)
                  first, last = turn.firstChild, turn.lastChild
  
                  for sync in syncs:
                      text = sync.firstChild
                      if text is None:
                          if last.isSameNode(sync) and len(syncs) > 0:
                              section_list[-1].append(
                                  sync.getAttribute("time")
                              )
                          continue
                      elif len(sync.childNodes) > 1:
                          # for combination of speakers
                          text = ""
                          for child in sync.childNodes:
                              text += child.data
                      else:
                          text = text.data
  
                      text = TextRefine(text)
  
                      text = text.translate(trantab)
                      start_time = sync.getAttribute("time")
  
                      if individual_speech:
                          spk = "None"
                      else:
                          spk = turn.getAttribute("speaker")
  
                      if first.isSameNode(sync):
                          if last.isSameNode(sync):
                              section_list.append(
                                  [
                                      spk,
                                      text,
                                      start_time,
                                      turn.getAttribute("endTime"),
                                  ]
                              )
                          else:
                              section_list.append(
                                  [spk, text, start_time]
                              )
                      else:
                          section_list[-1].append(start_time)
                          if last.isSameNode(sync):
                              section_list.append(
                                  [
                                      spk,
                                      text,
                                      start_time,
                                      turn.getAttribute("endTime"),
                                  ]
                              )
                          else:
                              section_list.append(
                                  [spk, text, start_time]
                              )
              xml_text.extend(section_list)
      for xml in xml_text:
          if len(xml) != 4:
              print("warning")
              print(xml)
      return audio_filename, speaker_info, xml_text
  
file_path: espnet/egs2/puebla_nahuatl/asr1/local/data_prep.py
imports: import os
  import re
  import shutil
  import string
  import sys
  from argparse import ArgumentParser
  from xml.dom.minidom import parse
label_desc: Use image node_id 4 for calling a global function with example usage: XMLProcessing(transcribe) and returns: audio_filename,  speaker_info,  xml_text