![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java JavaScript Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Java) Load XML from a Remote URLDemonstrates how to load XML from a remote URL, such as https://www.chilkatsoft.com/hamlet.xml
import com.chilkatsoft.*; public class ChilkatExample { static { try { System.loadLibrary("chilkat"); } catch (UnsatisfiedLinkError e) { System.err.println("Native code library failed to load.\n" + e); System.exit(1); } } public static void main(String argv[]) { // This example assumes the Chilkat HTTP API to have been previously unlocked. // See Global Unlock Sample for sample code. CkHttp http = new CkHttp(); CkStringBuilder sbXml = new CkStringBuilder(); // Download the XML from the URL into sbXml boolean success = http.QuickGetSb("https://www.chilkatsoft.com/hamlet.xml",sbXml); if (success == false) { System.out.println(http.lastErrorText()); return; } CkXml xml = new CkXml(); // Load the XML contained in sbXml success = xml.LoadSb(sbXml,true); if (success == false) { System.out.println(xml.lastErrorText()); return; } System.out.println("Success."); } } |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.