# Convert HTML to XML in Python

> Convert HTML content to PowerPoint XML in Python. Use the Aspose.Slides Python API to import HTML and save the generated slides as an XML presentation.

Source: https://products.aspose.com/slides/python-net/conversion/html-to-xml/
Updated: 2026-07-23



## Convert HTML to XML in Python

[*Aspose.Slides for Python via .NET*](/slides/python-net/) lets you import HTML content into a presentation and save the resulting slides in PowerPoint XML Presentation format. The API provides `SlideCollection.add_from_html` for importing HTML and `Presentation.save` with `SaveFormat.XML` for creating the output file.

`SaveFormat.XML` creates a PowerPoint XML Presentation document. It does not serialize the original HTML document into an arbitrary custom XML schema.

## Convert HTML to XML using Python

Create a `Presentation`, remove its default blank slide, import the HTML file, and save the generated slides as a PowerPoint XML Presentation document.

### Python code for converting HTML into XML

```python
with slides.Presentation() as presentation:
    presentation.slides.remove_at(0)

    with open("page.html", "rb") as html_stream:
        presentation.slides.add_from_html(html_stream)

    presentation.save("output.xml", slides.export.SaveFormat.XML)
```

## How to convert HTML to XML using Aspose.Slides for Python API

These are the steps to convert HTML to XML in Python.

Install [*Aspose.Slides for Python via .NET*](/slides/python-net/).

Create a `Presentation` and remove its default blank slide.

Open the source HTML file and pass its stream to `SlideCollection.add_from_html`.

Call `Presentation.save` with the output file path and `SaveFormat.XML`.

## Convert HTML to Other Supported Formats
