Next Previous Up Contents
Next: Read VOTable document structure
Up: Reading VOTables
Previous: Reading VOTables

6.3.1 Read a single VOTable from a file

The simplest way to read a VOTable is to use the generic table reading method described in Section 3.2, in which you just submit the URL or filename of a document to a StarTableFactory, and get back a StarTable object. If you're after one of several TABLE elements in a document, you can specify this by giving its number as the URL's fragment ID (the bit after the '#' sign).

The following code would give you StarTables read from the first and fourth TABLE elements in the file "tabledoc.xml":


    StarTableFactory factory = new StarTableFactory();
    StarTable tableA = factory.makeStarTable( "tabledoc.xml", "votable" );
    StarTable tableB = factory.makeStarTable( "tabledoc.xml#3", "votable" );

All the data and metadata from the TABLE in the VOTable document are available from the resulting StarTable object, as table parameters, ColumnInfos or the data themselves. If you are just trying to extract the data and metadata from a single TABLE element somewhere in a VOTable document, this procedure is probably all you need.

The parameters of the table which is obtained are taken from PARAM and INFO elements. PARAMs or INFOs in the TABLE element itself or in its RESOURCE parent are considererd to apply to the table. The values of these can be obtained using the getParameters method.


Next Previous Up Contents
Next: Read VOTable document structure
Up: Reading VOTables
Previous: Reading VOTables

STIL - Starlink Tables Infrastructure Library
Starlink User Note 252
STIL web page: http://www.starlink.ac.uk/stil/
Author email: m.b.taylor@bristol.ac.uk
Starlink: http://www.starlink.ac.uk/