Sample code for 30+ languages & platforms
Dart

Convert HTML File to XML File

See more HTML-to-XML/Text Examples

Convert HTML file to XML file.

Chilkat Dart Downloads

Dart
import 'package:chilkat/chilkat.dart';

void main() {
  // This example assumes the Chilkat API to have been previously unlocked.
  // See Global Unlock Sample for sample code.

  final htmlToXml = CkHtmlToXml();

  // Indicate the charset of the output XML we'll want.
  htmlToXml.xmlCharset = 'utf-8';

  try {
    htmlToXml.convertFile('test.html', 'out.xml');
    print('Success');
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
  }
}