12-09-2007, 09:37 AM
Using regular expression.
Next QM release also will have function HtmlParse that gets document object model of HTML.
Next QM release also will have function HtmlParse that gets document object model of HTML.
function $HTML [MSHTML.IHTMLDocument2&doc2] [MSHTML.IHTMLDocument3&doc3]
;Creates document object model of HTML.
;HTML - HTML.
;doc2, doc3 - variables that, after calling the function, can be used to get parsed HTML information. Can be omitted or 0.
;EXAMPLE
;str s
;IntGetFile "http://www.quickmacros.com" s ;;download a html file
;
;MSHTML.IHTMLDocument2 d; MSHTML.IHTMLDocument3 d3
;HtmlParse(s d d3)
;
;s=d.body.innerText
;ShowText "body text" s
;
;MSHTML.IHTMLElement el=d.links.item(6)
;s=el.getAttribute("href" 0)
;s.replacerx("^about:") ;;relative links have "about:" at the beginning
;ShowText "URL of 7-th link" s
;
;MSHTML.IHTMLElement eb=d3.getElementsByTagName("B").item(0)
;s=eb.innerText
;ShowText "text of first bold text" s
MSHTML.IHTMLDocument2 d._create(uuidof(MSHTML.HTMLDocument))
ARRAY(VARIANT) a.create(1)
a[0]=HTML
d.write(a)
if(&doc2) doc2=d
if(&doc3) doc3=+d