cds.xml
Class VOTable

java.lang.Object
  extended bycds.xml.XmlGen
      extended bycds.xml.VOTable

public class VOTable
extends XmlGen

VOTable class is an extension of XmlGen class. It generates a XML file according to the VOTable DTD. Methods here are application (VOTable) oriented.
For all methods wich add attributes or tags, no test is made to check if the addition is valid. It is the responsability of the developper to ensure this, according to the VOTable DTD or Xschema.
Most of the methods return the VOTable object itself, allowing thus 'concatenation' of calls:
votable.addNameAttr("myname").addDescription("descr_text")...

The method nomenclature tries to respect the following rules:
addTag() is used when the method completely deals with a given tag
openTag()...endTag() are used when two methods() are needed to open and close the tag.
addNameAttr(String val) is used for adding an attribute to the current tag

This class doesn't yet reflect the whole VOTable standard. First of all, because it is not yet stable, secondly because only the methods needed by SIMBAD are implemented...

Version:
1.0 Feb 2002
Author:
Wenger Marc (CDS)

Field Summary
private static java.lang.String dtdName
           
private static java.lang.String mainTag
           
private static java.lang.String TAG_CELL
           
private static java.lang.String TAG_ROW
           
private static java.lang.String version
           
private static Parameters votParms
           
private static java.lang.String xmlns
           
 
Fields inherited from class cds.xml.XmlGen
 
Constructor Summary
VOTable(java.io.OutputStream os)
          Creates a VOTable object The XML introduction tags are written
VOTable(java.io.OutputStream os, java.lang.String id)
          Creates a VOTable object with an ID in the main tag The XML introduction tags are written
 
Method Summary
 VOTable addCell(java.lang.String data)
          Adds a cell (TD tag) to a row
 VOTable addCell(java.lang.String data, java.lang.String ref)
          Adds a cell (TD tag) to a row
 VOTable addCoosys(java.lang.String sys, java.lang.String eq, java.lang.String ep)
          Adds a COOSYS tag.
 VOTable addCoosys(java.lang.String id, java.lang.String sys, java.lang.String eq, java.lang.String ep)
          Adds a COOSYS tag.
 VOTable addDescription(java.lang.String text)
          Adds a DESCRIPTION tag to the current entry
 VOTable addField(VotField fld)
          Adds a field tag.
 VOTable addFieldList(java.util.ArrayList fields)
          adds a field list (an ArrayList)
 VOTable addLink(java.lang.String link)
          Add a LINK Tag To be developped
 VOTable addNameAttr(java.lang.String name)
          Adds a name (attribute) to the current entry
 VOTable addParam()
          Add a PARAM tag.
 VOTable addRefAttr(java.lang.String ref)
          Adds a reference (attribute) to the current entry
 VOTable closeCell()
          Closes the current cell (TD tag)
 VOTable closeDefinitions()
          Closes a DEFINITIONS tag
 VOTable closeResource()
          Closes the most recently opened RESOURCE tag If other tags inside the RESOURCE tag are still opened, they will be automatically closed.
 VOTable closeRow()
          Closes a row (TR tag).
 VOTable closeTable()
          Closes a TABLE tag
 VOTable closeTabledata()
          Closes a TABLEDATA tag Includes the closingof the DATA tag
 VOTable nextRow()
          Closes a row (TR tag) and opens the next one.
private  void open(java.lang.String id)
           
 VOTable openCell()
          Opens a cell(TD tag)
 VOTable openDefinitons()
          Opens a DEFINITIONS tag (needed to embed COOSYS and PARAM tags)
 VOTable openResource()
          Opens a RESOURCE tag.
 VOTable openResource(java.lang.String name)
          Opens a RESOURCE tag.
 VOTable openRow()
          Opens a row (TR tag).
 VOTable openTable()
          Opens a TABLE tag.
 VOTable openTable(java.lang.String name)
          Opens a TABLE tag.
 VOTable openTabledata()
          Opens a TABLEDATA tag Includes the opening of the DATA tag
 
Methods inherited from class cds.xml.XmlGen
addAttr, addAttr, addID, addText, addText, close, closeAllTags, closeTag, closeTag, doctype, flush, getCurrentTagName, indent, openTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

votParms

private static Parameters votParms

dtdName

private static java.lang.String dtdName

xmlns

private static java.lang.String xmlns

version

private static final java.lang.String version
See Also:
Constant Field Values

mainTag

private static final java.lang.String mainTag
See Also:
Constant Field Values

TAG_ROW

private static final java.lang.String TAG_ROW
See Also:
Constant Field Values

TAG_CELL

private static final java.lang.String TAG_CELL
See Also:
Constant Field Values
Constructor Detail

VOTable

public VOTable(java.io.OutputStream os,
               java.lang.String id)
Creates a VOTable object with an ID in the main tag The XML introduction tags are written

Parameters:
os - OutputStream where the VOTable will be written
id - XML identifier

VOTable

public VOTable(java.io.OutputStream os)
Creates a VOTable object The XML introduction tags are written

Parameters:
os - OutputStream where the VOTable will be written
Method Detail

open

private void open(java.lang.String id)

addNameAttr

public VOTable addNameAttr(java.lang.String name)
Adds a name (attribute) to the current entry

Parameters:
name - name to be added as a 'name' attribute
Returns:
the VOTable object

addRefAttr

public VOTable addRefAttr(java.lang.String ref)
Adds a reference (attribute) to the current entry

Parameters:
ref - reference to be added as a 'ref' attribute
Returns:
the VOTable object

addDescription

public VOTable addDescription(java.lang.String text)
Adds a DESCRIPTION tag to the current entry

Parameters:
text - Description text
Returns:
the VOTable object

openDefinitons

public VOTable openDefinitons()
Opens a DEFINITIONS tag (needed to embed COOSYS and PARAM tags)


closeDefinitions

public VOTable closeDefinitions()
Closes a DEFINITIONS tag


addCoosys

public VOTable addCoosys(java.lang.String sys,
                         java.lang.String eq,
                         java.lang.String ep)
Adds a COOSYS tag. The COOSYS tag must be inside a DEFINITIONS tag which has to be opened before, and closed after the COOSYS and PARAM tag additions

Parameters:
sys - Coordinate system (eq_FK4, eq_FK5, ICRS, ecl_FK4, ecl_FK5, galactic, supergalactic, xy, barycentric, geo_app) or null
eq - Equinoxe (or null)
ep - Epoch (or null)
Returns:
the VOTable object

addCoosys

public VOTable addCoosys(java.lang.String id,
                         java.lang.String sys,
                         java.lang.String eq,
                         java.lang.String ep)
Adds a COOSYS tag. The COOSYS tag must be inside a DEFINITIONS tag which has to be opened before, and closed after the COOSYS and PARAM tag additions

Parameters:
id - Tag identifier
sys - Coordinate system (eq_FK4, eq_FK5, ICRS, ecl_FK4, ecl_FK5, galactic, supergalactic, xy, barycentric, geo_app) or null
eq - Equinoxe (or null)
ep - Epoch (or null)
Returns:
the VOTable object
See Also:
addParam()

addParam

public VOTable addParam()
Add a PARAM tag. Like the COOSYS tag, this one must be inside a DEFINITIONS tag
TO BE DEVELOPPED...


addLink

public VOTable addLink(java.lang.String link)
Add a LINK Tag To be developped

Parameters:
link - link to be added
Returns:
the VOTable object

openResource

public VOTable openResource()
Opens a RESOURCE tag.

Returns:
the VOTable object
See Also:
closeResource()

openResource

public VOTable openResource(java.lang.String name)
Opens a RESOURCE tag.

Parameters:
name - name attribute to add
Returns:
the VOTable object
See Also:
closeResource()

closeResource

public VOTable closeResource()
Closes the most recently opened RESOURCE tag If other tags inside the RESOURCE tag are still opened, they will be automatically closed.

Returns:
the VOTable object

openTable

public VOTable openTable()
Opens a TABLE tag.

Returns:
the VOTable object
See Also:
closeTable()

openTable

public VOTable openTable(java.lang.String name)
Opens a TABLE tag.

Parameters:
name - name attribute for the TABLE tag
Returns:
the VOTable object
See Also:
closeTable()

closeTable

public VOTable closeTable()
Closes a TABLE tag

Returns:
the VOTable object

addField

public VOTable addField(VotField fld)
Adds a field tag. The Field object is generally created from a file describing the existing fields. It can then be completed by programme, or even completely created from scratch.
In a XML file, a particular FIELD is fully written only once. Afterwards, only a reference to its full definition is written.

Parameters:
fld - VotField object to use to build the FIELD tag with all its attributes and inner elements
Returns:
the VOTable object

addFieldList

public VOTable addFieldList(java.util.ArrayList fields)
adds a field list (an ArrayList)

Parameters:
fields - an ArrayList of VotField objects
Returns:
the VOTable object

openTabledata

public VOTable openTabledata()
Opens a TABLEDATA tag Includes the opening of the DATA tag

Returns:
the VOTable object

closeTabledata

public VOTable closeTabledata()
Closes a TABLEDATA tag Includes the closingof the DATA tag

Returns:
the VOTable object

openRow

public VOTable openRow()
Opens a row (TR tag).

Returns:
the VOTable object

nextRow

public VOTable nextRow()
Closes a row (TR tag) and opens the next one. Used for intermediate rows

Returns:
the VOTable object

closeRow

public VOTable closeRow()
Closes a row (TR tag). Used after the last row of a table

Returns:
the VOTable object

addCell

public VOTable addCell(java.lang.String data)
Adds a cell (TD tag) to a row

Parameters:
data - string containing the data of the cell.
Returns:
the VOTable object

addCell

public VOTable addCell(java.lang.String data,
                       java.lang.String ref)
Adds a cell (TD tag) to a row

Parameters:
data - string containing the data of the cell.
ref - Reference attribute to associate with this cell
Returns:
the VOTable object

openCell

public VOTable openCell()
Opens a cell(TD tag)

Returns:
the VOTable object

closeCell

public VOTable closeCell()
Closes the current cell (TD tag)

Returns:
the VOTable object