------------------------------------------------------------------------
XML(VO) files
------------------------------------------------------------------------
XML is a verbose data format of conveying data that has been adopted world wide. It
appears to have four parts describe in the Appendix. XML is used by the Virtual
Observatory (VO) and so I will use the term VO and XML table interchangeably.
In the spirit of swash-bucklers we will build an efficient bash tool to
give us a delimited (tsv, csv) table. We will call the input file as $IF.
I. Extract the announcement
$ ANNOUNCE=$(sed -n '/
/p' $IF | tr -d '\n' | sed 's/.*name="//;s/".*$//')
$ echo $ANNOUNCE
III. Extract the header
$ grep " hdr
IV. Extract the data
The table consists of lines starting with and ending
with . Within this we have records (
..
) and
fields (
..
as follows.
We will map to "$DRS" (record separator) and every
(field) will be mapped to "$DFS" (field separator). For instance,
DRS="\n" and DFS="\t" are good default values.
To this end, we extract the lines within the TABLEDATA block. Since
we are interested in the end ponts and we get rid of
and
. To my knowledge, XLM is not line oriented and so
I mush all the lines into one long line with "tr -d '\n'". We then
map the DRS and DFS.
$ sed -n '//,/<.TABLEDATA>/p' $IF | sed '1d;$d;s/
//g;s/
//g' | tr -d "\n" | gsed 's/<.TD>/'"$DFS"'/g;s/<.TR>/'"$DRS"'/g' > data
We are now done
$ cat hdr data > table
------------------------------------------------------------------------
APPENDIX A.I The Announcement
------------------------------------------------------------------------
------------------------------------------------------------------------
Appendix A.II. Preamble "RESOURCE"
------------------------------------------------------------------------
Results from query to NASA/IPAC Extragalactic Database (NED),
which is operated by the Jet Propulsion Laboratory, California Institute of
Technology, under contract with the National Aeronautics and Space Administration.
This work was (partially) supported by the US National Virtual Observatory
development project, which is funded by the National Science Foundation
under cooperative agreement AST0122449 with The Johns Hopkins University.
Galactic Extinction Calculation Results for given coordinates.
------------------------------------------------------------------------
Appendix A.III. The Table Caption: "TABLE ID"
------------------------------------------------------------------------
Galactic Extinction Calculation Results for given coordinates.
III. The Header of the Table: DESCRIPTION AND TABLE FIELDS
Bandpass common name
------------------------------------------------------------------------
Appendix A.III The Data (finally)
------------------------------------------------------------------------