Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save conholdate-com-kb/421273e41d2c604d294eb9fa87ea20c5 to your computer and use it in GitHub Desktop.
Save conholdate-com-kb/421273e41d2c604d294eb9fa87ea20c5 to your computer and use it in GitHub Desktop.
How to Convert XML to HTML in Java. For more information, please follow link: https://kb.conholdate.com/total/java/how-to-convert-xml-to-html-in-java
import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.licensing.License;
import com.groupdocs.conversion.options.convert.MarkupConvertOptions;
public class ConvertXmlToHtmlInJava {
public static void main(String[] args) { // Main function to convert XML to HTML in Java
// Remove the watermark in output HTML document by adding license
License lic = new License();
lic.setLicense("/path/to/GroupDocs.Conversion.lic");
// Load the source XML file for conversion to HTML
Converter converter = new Converter("/path/to/sample.xml");
// Set the convert options for HTML format
MarkupConvertOptions options = new MarkupConvertOptions();
// Convert and save the XML in HTML format
converter.convert("/path/to/converted.html", options);
System.out.println("Done");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment