title: XmlService.parse() not able to handle HTML tables
body: <p>I am looking for help from this community regarding the below issue.</p>
  
  <pre><code>// I am searching my Gmail inbox for a specific email
  
  function getWeeklyEmail() {
    var emailFilter = 'newer_than:7d AND label:inbox AND "Report: Launchpad filter"';
    var threads = GmailApp.search(emailFilter, 0, 5);
    var messages=[];
    threads.forEach(function(threads)
                    {
                     messages.push(threads.getMessages()[0]);
             });
    return messages;
    }
  
  // Trying to parse the HTML table contained within the email
  
  function getParsedMsg() {
  
    var messages = getWeeklyEmail();
    var msgbody = messages[0].getBody();
    var doc = XmlService.parse(msgbody);
    var html = doc.getRootElement();
    var tables = doc.getDescendants();
  
    var templ = HtmlService.createTemplateFromFile('Messages1');
    templ.tables = [];
  
    return templ.evaluate(); 
  }
  </code></pre>
  
  <p>The debugger crashes when I try to step over the XmlService.parse function. The msgbody of the email contains both text and HTML formatted table. I am getting the following error: TypeError: Cannot read property 'getBody' of undefined (line 19, file "Code")</p>
  
  <p>If I remove the getParsedMsg function and instead just display the content of the email, I get the email body along with the element tags etc in html format.</p>