aardio 文档

aardio 范例: string.html 与 MSHTML

//string.html 与 MSHTML

var html=  /* 
<!doctype html>
<html>
  <head></head>
  <body>
    <table id="container"><tr><td class="tab_time tab_time102540630" rowspan="1">06:30</td></tr></table>
    <pre>网页文本</pre>
  </body>
</html>
*/

import console;
import string.html;

//string.html 继承自 string.xml
var htmlDoc = string.html(html)

var ele = htmlDoc.getEleByTag("body")
console.log( ele.outerXml ) //也可以写为 ele.outerHTML

/*
string.html 的解析器相对简洁,
而 web.mshtml 基于操作系统自带的 MSHTML,功能更丰富。
*/
import web.mshtml;
var htmlDoc = web.mshtml();
htmlDoc.html = html;

var body = htmlDoc.querySelector("body");

for i,ele in htmlDoc.eachAll() {
    console.log(i,ele.outerHTML)
}

console.more(,true);

var ele =  htmlDoc.jQuery("body")[0] 
console.log( ele.innerText )

console.pause()
Markdown 格式