Xbase++
Xbase++
Download HTML from URL and Convert to XML
See more HTML-to-XML/Text Examples
Downloads an HTML page from a URL and converts it to XML.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oGlob
LOCAL oHttp
LOCAL cHtml
LOCAL oHtmlToXml
LOCAL cXml
nSuccess := 0
// Note: This example requires the Chilkat Bundle license.
// Any string argument automatically begins the 30-day trial.
oGlob := CreateObject("Chilkat.Global")
nSuccess := oGlob:UnlockBundle("30-day trial")
IF (nSuccess != 1)
? oGlob:LastErrorText
oGlob:destroy()
RETURN
ENDIF
oHttp := CreateObject("Chilkat.Http")
cHtml := oHttp:QuickGetStr("http://www.intel.com/")
IF (oHttp:LastMethodSuccess != 1)
? oHttp:LastErrorText
oGlob:destroy()
oHttp:destroy()
RETURN
ENDIF
oHtmlToXml := CreateObject("Chilkat.HtmlToXml")
// Indicate the charset of the output XML we'll want.
oHtmlToXml:XmlCharset := "utf-8"
// Set the HTML:
oHtmlToXml:Html := cHtml
// Convert to XML:
cXml := oHtmlToXml:ToXml()
// Save the XML to a file.
// Make sure your charset here matches the charset
// used for the XmlCharset property.
nSuccess := oHtmlToXml:WriteStringToFile(cXml, "qa_output/out.xml", "utf-8")
? "Finished."
oGlob:destroy()
oHttp:destroy()
oHtmlToXml:destroy()