How VBS parses HTML documents (Htmlfile)
Submission: MDXY-DXY font: [Increase decrease] Type: Reprint time: 2014-06-18 I want to comment
About VBS collection, online popular more methods are regular, in fact, Htmlfile can parse HTML code, but if DesignMode not open, sometimes package security information
About VBS collection, online popular more methods are regular, in fact, Htmlfile can parse HTML code, but if DesignMode not open, sometimes package security information.
But to open the DesignMode (@ the evening of the Prophet), all JS will not be executed, just clean DOM documents, so in the case of forced to open DesignMode general situation remains the default.
?
1234567891011121314 |
Set html = CreateObject(
"htmlfile"
)
Set http = CreateObject(
"Msxml2.ServerXMLHTTP"
)
html.designMode =
"on" ‘ 开启编辑模式
http.open
"GET"
,
"http://www.cnblogs.com/"
,
False
http.send
strHtml = http.responseText
html.write strHtml
‘ 写入数据
Set post_list = html.getElementById(
"post_list"
)
For Each el
In post_list.children
WScript.Echo el.getElementsByTagName(
"a"
)(0).innerText
Next
|
In fact, the method is very simple, but the focus will be VBS, but not necessarily DOM operation, so this is very tangled.
I have no choice but to rely on your own, I just share the idea,
Parsing HTML is easier and quicker than regular.
How VBS parses an HTML document