# Convert HTML to XML in Java

> Convert HTML content to PowerPoint XML Presentation format in Java with Aspose.Slides for Java.

Source: https://products.aspose.com/slides/java/conversion/html-to-xml/
Updated: 2026-07-30



## Convert HTML to XML in Java

[**Aspose.Slides for Java**](/slides/java/) can import HTML content into presentation slides and save the resulting presentation in PowerPoint XML Presentation format.

The generated XML represents a presentation rather than a generic transformation of the source HTML markup. Aspose.Slides can also export the imported content to PowerPoint, PDF, images, and other supported formats.

## Convert HTML to XML using Java

To convert HTML content to PowerPoint XML, create a `Presentation`, remove its default slide, import the HTML with `addFromHtml`, and call `save` with `SaveFormat.Xml`.

### Java code for converting HTML into XML

```java
Presentation presentation = new Presentation();
try {
    presentation.getSlides().removeAt(0);
    try (FileInputStream htmlStream = new FileInputStream("page.html")) {
        presentation.getSlides().addFromHtml(htmlStream);
    }

    presentation.save("output.xml", SaveFormat.Xml);
} finally {
    presentation.dispose();
}
```

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

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

Install [**Aspose.Slides for Java**](/slides/java/).

Add a library reference (import the library) to your Java project.

Load the source `HTML` file into a `Presentation`.

Call `save` with the output file path and `SaveFormat.Xml`.

## Convert HTML To Other Supported Formats

- [HTML TO IMAGE](/slides/java/conversion/html-to-image/)
- [HTML TO JPG](/slides/java/conversion/html-to-jpg/)
- [HTML TO PDF](/slides/java/conversion/html-to-pdf/)
- [HTML TO PNG](/slides/java/conversion/html-to-png/)
- [HTML TO TIFF](/slides/java/conversion/html-to-tiff/)
