Display XML Data in HTML Page

XML stands as a self-descriptive language supported by W3C, purpose-built for efficient data storage and seamless data exchange. For Python application developers, the adaptability of XML format allows for easy transformation into user-friendly, human-readable formats like HTML. This article will guide you through the process of leveraging GroupDocs.Assembly Cloud SDK for Python and simple templates to translate XML data into comprehensive HTML reports.


Before getting started, make sure you have the following in place:

  • Python installed on your system.
  • GroupDocs.Assembly Cloud SDK for Python installed.
  • An active GroupDocs.Assembly Cloud account with valid API credentials.
  • Sample data and templates for testing (we will use the following sample XML data and report template).

Sample XML Data

Use the following XML data.

		<Name>John Smith</Name>
				<Name>A Company</Name>
		<Name>Tony Anderson</Name>

Sample Template

Generate the specified template in TXT, DOCX, or the necessary format for iterating through Managers’ data alongside their corresponding Clients and related information. Subsequently, proceed with the implementation of the code to generate the report.

<<foreach \[in managers\]>>Manager: <<\[Name\]>>
<<foreach \[in Contract\]>>- <<\[Client.Name\]>> ($<<\[Price\]>>)

Points to be covered:

Configure the Python HTML Report Generator SDK

To initiate the process, incorporate the GroupDocs.Assembly Cloud SDK for Python into your Python project by utilizing pip (Python’s package installer). Execute the subsequent command in the console:

pip install groupdocs-assembly-cloud

Launch the API Client

Next, retrieve your Client ID and Client Secret from the dashboard, and incorporate the provided code as illustrated below:

Upload the Data Source and Template Files

Firstly, upload the data source and template files to the cloud using the code example given below:

As a result, the uploaded files will be available in the [files section][https://dashboard.groupdocs.cloud/files] of your dashboard on the cloud.

Display XML Data on an HTML Page using Python

To present XML data within an HTML page, adhere to the subsequent steps:

  1. Create an instance of AssemblyApi with client_id and client_secret.
  2. Set up template information with a file path, storage name, version ID, and password.
  3. Prepare the assemble request using AssembleOptions with report data, template info, output path, and save format.
  4. Generate the HTML report using AssemblyApi.assemble_document(AssembleOptions) method.

The provided code sample exemplifies the implementation of Python SDK for HTML report generator REST API, enabling the presentation of XML data on an HTML page.

Download HTML File

The code given in the previous step saves the converted HTML file on the cloud. To download it, you can use the following code snippet.


Within this article, we have encompassed the steps involved in presenting XML data on an HTML page via the utilization of GroupDocs.Assembly Cloud REST API in conjunction with its Python SDK. This robust API empowers developers to seamlessly craft dynamic reports across diverse formats, harnessing information from XML or XML sources, and melding templates spanning Word documents, spreadsheets, and text files.

Additionally, for a more comprehensive grasp of the GroupDocs.Assembly Cloud API, delve into the detailed documentation. Also, take advantage of our API reference area, which empowers you to directly engage with and observe our APIs in action right from your browser. You can also freely access the complete source code of the Python SDK on Github.

In closing, we consistently produce fresh blog articles exploring a range of file formats and their parsing utilizing the REST API. Reach out to us for the most up-to-date information.

Ask a question

In case you would have any queries or confusion about the HTML report generator, please feel free to contact us via our forum.

See Also

Here are some related articles that you may find helpful: