! bn_show_xml_file.jnl
! Testing SHOW DATA/OUTFILE
!         SHOW AXIS/OUTFILE
!         SHOW VAR/OUTFILE
!         SAY/OUTFILE
!
! Similar to LAS iosp script header.jnl
! capability to be expanded to all SHOW commands in the future.
! 5/2012:
! Do this on a dataset with just one variable.
! Dont do show axis/all. Just the axes for one variable is a lot of output.
! Ferret v685, show/data/var/xml includes the output of show axis, so remove that.

! create a short file
LET sst = x[x=1:15] + y[y=1:5] + t[gt=month_irreg] 
save/clobber/file=b.nc sst
can var/all

use b

DEFINE SYMBOL output_xml_file = the_xml_file.xml

say/quiet/outfile=($output_xml_file)/clobber <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
say/quiet/outfile=($output_xml_file)/append <data>

show var/xml/append/outfile=($output_xml_file)
show data/var/xml/append/outfile=($output_xml_file)
say/quiet/outfile=($output_xml_file)/append </data>

! on 32-bit machine the cat command below doesnt show file contents if
! the file is still open. Close it by listing to another file.
list/clobber/file=dummy.dat 1  


! Note with the fix to ticket 883, the ordering of the axis listing is
! different. This is unimportant to using the xml files.
sp cat the_xml_file.xml

