XML to HTML

Hello,
Just curios if a special task can be done using any of Aspose products?

We have an XML file as source, if you open any XML file inside Internet Explorer, you will find it’s decorated and colored.
I need to convert XML to Html just as shown by Internet Explorer, however, the -/+ node expanders are not needed.
Possible?

@australian.dev.nerds,

We have Asopse.Words and Aspose.PDF APIs for the task. Both libraries are capable to parse/read XML files and render to HTML file format. See the documents on supported file formats for your reference.
https://docs.aspose.com/words/net/supported-document-formats/ (Aspose.Words)
https://docs.aspose.com/pdf/net/supported-file-formats/ (Aspose.PDF)

Could you please share a sample XML file and your desired output HTML file for reference. We will check it soon.

1 Like

Hello,
Any XML file can be used, eg Aspose XML files beside DLLs.

This snapshot image shows the expected HTML:
XMLSample.zip (122.8 KB)

I need to load XML and save it as HTML file like this snapshot, so in any browser that even does not support XML, show the HTML like the snapshot.
Any Aspose product support it? :slight_smile:
Thanks,

@australian.dev.nerds You can achieve something similar to the expected output by loading XML document as TEXT document into Aspose.Words document:

LoadOptions opt = new LoadOptions();
opt.LoadFormat = LoadFormat.Text;
Document doc = new Document(@"C:\Temp\in.xml", opt);
doc.Save(@"C:\Temp\out.html");
1 Like

Hello,
Thanks, kindly see snapshot:
Html.png (263.0 KB)

Some tags like < summary > are line splitted as seen in the snapshot.

Test on Aspose.Words.xml, seems the output Html size will be insane while should not be much more than original xml?

Finally, no any color formatting options for output?

What about a special function to transform xml to html?
Thanks :slight_smile:

@australian.dev.nerds When you load XML document as TEXT it is loaded as is, Aspose.Words does not reformat it. I am afraid what you are trying to achieve is out of Aspose.Words scope.