Some of the classes I TA use Maple. (Caveat: I prefer Python, as a more general language. Use SymPy or Sage if you need symbolic processing.) Anyhow, I get Maple worksheets to grade. SSHing into the department computer lab to fire up xmaple is a pain, so I wrote mw2txt.py to extract the Maple commands from the worksheet. It benefits from the fact that worksheets are fairly clean XML. Graphs and equations are more difficult, since they have complicated layout and are stored as encoded blobs. Other than that, things work pretty well. Here's the output from my example.mw example worksheet, picking out the math-mode sections (in red) and unprocessed blocks (in yellow) from the comments (uncolored).

$ mw2txt.py --color example.mw 
Hi there
> restart;
> interface(prettyprint=0):
> 1;# one  + plus 2 two ;
1
> 3 + 4;  bold
7
Equation