DataFlex
DataFlex
Load XML from a Remote URL
Demonstrates how to load XML from a remote URL, such as https://www.chilkatsoft.com/hamlet.xmlChilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoHttp
Variant vSbXml
Handle hoSbXml
Handle hoXml
String sTemp1
Move False To iSuccess
// This example assumes the Chilkat HTTP API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbXml
If (Not(IsComObjectCreated(hoSbXml))) Begin
Send CreateComObject of hoSbXml
End
// Download the XML from the URL into sbXml
Get pvComObject of hoSbXml to vSbXml
Get ComQuickGetSb Of hoHttp "https://www.chilkatsoft.com/hamlet.xml" vSbXml To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatXml)) To hoXml
If (Not(IsComObjectCreated(hoXml))) Begin
Send CreateComObject of hoXml
End
// Load the XML contained in sbXml
Get pvComObject of hoSbXml to vSbXml
Get ComLoadSb Of hoXml vSbXml True To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoXml To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Success."
End_Procedure