home
PDF (letter size)
PDF (legal size)

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

Nasser M. Abbasi

July 1, 2016 compiled on — Friday July 01, 2016 at 02:25 AM

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