home
PDF (letter size)
PDF (legal size)

How to convert XML file to Mathematica Grid and to Latex table

Nasser M. Abbasi

May 13, 2020   Compiled on May 13, 2020 at 5:40pm

This is an example how to read a plain text XML file in Mathematica, and display its content in a Mathematica Grid (table like).

I used an example XML I found on the net (ref [2]), which is a plain text file that contains some made up student information.

The first step is to download the above file to some folder, then create the following Mathematica code

The above now displays the symbolic XML

Now we read all the fields, using Cases

Now put them in a grid

This is the result

pict

Finally, the output is converted to Latex in the fly, and compiled to HTML and pdf using tex4ht and pdflatex. Here is the result

  1. pdf
  2. HTML

This is the Mathematica code used to convert the table to Latex

That is all.

References

  1. https://reference.wolfram.com/language/XML/tutorial/TransformingXML.html
  2. http://www.functionx.com/xml/Lesson01.htm