Sample code for 30+ languages & platforms
DataFlex

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

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoGlob
    Handle hoHttp
    String sHtml
    Handle hoHtmlToXml
    String sXml
    String sTemp1
    Boolean bTemp1

    Move False To iSuccess

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

    // Any string argument automatically begins the 30-day trial.
    Get Create (RefClass(cComChilkatGlobal)) To hoGlob
    If (Not(IsComObjectCreated(hoGlob))) Begin
        Send CreateComObject of hoGlob
    End
    Get ComUnlockBundle Of hoGlob "30-day trial" To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoGlob To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Get ComQuickGetStr Of hoHttp "http://www.intel.com/" To sHtml
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 <> True) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatHtmlToXml)) To hoHtmlToXml
    If (Not(IsComObjectCreated(hoHtmlToXml))) Begin
        Send CreateComObject of hoHtmlToXml
    End

    // Indicate the charset of the output XML we'll want.
    Set ComXmlCharset Of hoHtmlToXml To "utf-8"

    // Set the HTML:
    Set ComHtml Of hoHtmlToXml To sHtml

    // Convert to XML:

    Get ComToXml Of hoHtmlToXml To sXml

    // Save the XML to a file.
    // Make sure your charset here matches the charset
    // used for the XmlCharset property.
    Get ComWriteStringToFile Of hoHtmlToXml sXml "qa_output/out.xml" "utf-8" To iSuccess

    Showln "Finished."


End_Procedure