Sample code for 30+ languages & platforms
Chilkat2-Python

Convert HTML File to XML File

See more HTML-to-XML/Text Examples

Convert HTML file to XML file.

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import chilkat2

success = False

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

htmlToXml = chilkat2.HtmlToXml()

# Indicate the charset of the output XML we'll want.
htmlToXml.XmlCharset = "utf-8"

success = htmlToXml.ConvertFile("test.html","out.xml")
if (success != True):
    print(htmlToXml.LastErrorText)
else:
    print("Success")