Convert HTML to XML in Java

Import HTML content into presentation slides and save the result in PowerPoint XML Presentation format.

Convert HTML to XML in Java

Aspose.Slides for 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

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.

  1. Install Aspose.Slides for Java .

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

  3. Load the source HTML file into a Presentation.

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

Free Online Converter

Convert presentations and slides online.

Convert HTML To Other Supported Formats

You can also convert HTML and save it to other file formats.