0
我正在尋找使用緊固件來從Google Apps腳本中的內容中分離HTML標記的方法。在Google Apps腳本中條帶化HTML標記
現在我使用這些功能HTML解析:
function getTextFromHtml(body) {
return getTextFromNode(Xml.parse(body, true).getElement());
}
function getTextFromNode(x) {
switch(x.toString()) {
case 'XmlText': return x.toXmlString();
case 'XmlElement': return x.getNodes().map(getTextFromNode).join('');
default: return '';
}
}
但對於大的HTML的這種方式是如此低效。
樣本HTML內容:http://pastebin.com/FmB4hvN2
任何想法?
你是對的!謝謝! – Labradorcode