Dart
Dart
Load XML from a Remote URL
Demonstrates how to load XML from a remote URL, such as https://www.chilkatsoft.com/hamlet.xmlChilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
// This example assumes the Chilkat HTTP API to have been previously unlocked.
// See Global Unlock Sample for sample code.
final http = CkHttp();
final sbXml = CkStringBuilder();
// Download the XML from the URL into sbXml
try {
http.quickGetSb('https://www.chilkatsoft.com/hamlet.xml', sbXml);
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
final xml = CkXml();
// Load the XML contained in sbXml
try {
xml.loadSb(sbXml, true);
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
print('Success.');
}