Sample code for 30+ languages & platforms
PowerBuilder

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 PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Glob
oleobject loo_Http
string ls_Html
oleobject loo_HtmlToXml
string ls_Xml

li_Success = 0

// Note: This example requires the Chilkat Bundle license.

// Any string argument automatically begins the 30-day trial.
loo_Glob = create oleobject
li_rc = loo_Glob.ConnectToNewObject("Chilkat.Global")
if li_rc < 0 then
    destroy loo_Glob
    MessageBox("Error","Connecting to COM object failed")
    return
end if
li_Success = loo_Glob.UnlockBundle("30-day trial")
if li_Success <> 1 then
    Write-Debug loo_Glob.LastErrorText
    destroy loo_Glob
    return
end if

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")

ls_Html = loo_Http.QuickGetStr("http://www.intel.com/")
if loo_Http.LastMethodSuccess <> 1 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Glob
    destroy loo_Http
    return
end if

loo_HtmlToXml = create oleobject
li_rc = loo_HtmlToXml.ConnectToNewObject("Chilkat.HtmlToXml")

// Indicate the charset of the output XML we'll want.
loo_HtmlToXml.XmlCharset = "utf-8"

// Set the HTML:
loo_HtmlToXml.Html = ls_Html

// Convert to XML:

ls_Xml = loo_HtmlToXml.ToXml()

// Save the XML to a file.
// Make sure your charset here matches the charset
// used for the XmlCharset property.
li_Success = loo_HtmlToXml.WriteStringToFile(ls_Xml,"qa_output/out.xml","utf-8")

Write-Debug "Finished."


destroy loo_Glob
destroy loo_Http
destroy loo_HtmlToXml