Why am I getting a system identifier error with my google app script



I'm using the following Google Apps Script to do some screen scraping.



function getLinks(html) {
var doc = XmlService.parse(html);
var html = doc.getRootElement();
var table = getElementsByClassName(html, "headLinks")[0];
var output = '';
var linksInMenu = getElementsByTagName(table, 'a');
for(i in linksInMenu) output+= XmlService.getRawFormat().format(linksInMenu[i])+'<br>';
return HtmlService.createHtmlOutput(output);
}


The first line of code: var doc = XmlService.parse(html); is throwing the following error:



Error on line 2: The system identifier must begin with either a single or double quote character


I believe the error message is telling me that the html there are no single or double quotes around the system Id. Line 2 of the html follows:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ift.tt/kkyg93">


I not sure what is meant by system identifer. Has anyone run into to this problem and have you been able to come up with a workaround or solution.


The Google Apps Script code comes from Romain Vialard's: website


No comments:

Post a Comment