cds.xml
Interface TableParserConsumer

All Known Implementing Classes:
PlanObjet

public interface TableParserConsumer

Interface of an TableParser event consumer. This interface is used by TableParser object when it parses A table (TSV,CSV,Astrores,VOTable,VOTable with CSV). These documents describes astronomical resources. Astronomical resources means in this context: . excerpt tables or complete tables . lists of table descriptions . lists of server descriptions The aim is to give enough knowledge to the user interfaces to manipulate these resources (units, formats, anchors, natural language descriptions, nomenclatures, value ranges...). Example of usage :

 import cds.xml.*;
 import java.io.*;
 import java.util.*;

 public class TableParserDemo implements TableParserConsumer {
    TableParser ap;

    // Create and launch the TableParser parsing
    TableParserDemo(DataInputStream dis) {
       ap = new TableParser(this);
       if( !ap.parse(dis) ) System.err.println( ap.getError() );
    }

    // Method called at the beginning of a resource
    public void startResource(String ID) {
       System.out.println("Resource: "+ID);
    }

    // Method called to give additionnal information about the current resource
    public void setResourceInfo(String name,String value) {
       System.out.println("   .Resource info: "+name+"="+value);
    }

    // Method called at the end of a resource
    public void endResource() {
       System.out.println("End resource");
    }

    // Method called at the beginning of a table
    public void startTable(String ID) {
       System.out.println("   - Table: "+ID);
    }

    // Method called to give additionnal information about the current table
    public void setTableInfo(String name,String value) {
       System.out.println("      .Table info: "+name+"="+value);
    }

    // Method called at the end of a table
    public void endTable() {
       System.out.println("    End table");
    }

    // Method called to transmit a field description from the current table
    // See the Field class attributs
    public void setField(Field f) {
       System.out.println("      .Field: "+f.name+": "+f.description);
    }

    // Method called to transmit a record from the current table
    public void setRecord(double ra,double dec,String [] field) {
       System.out.print("      .Record: ("+ra+","+dec+") ");
       for( int i=0; i<3 && i

Version:
1.0 10/5/05 Rename, 1.0 3/09/99 Creation
Author:
P.Fernique [CDS]

Method Summary
 void endResource()
          This method is called by the TableParser parser when the XML /RESOURCE is encountered.
 void endTable()
          This method is called by the TableParser parser when the XML is encountered.
 void setField(Field f)
          This method is called by the TableParser parser when the XML /FIELD is encountered (the end of the element FIELD). ==> See Field object to have more details
 void setFilter(java.lang.String filter)
          This method is called by the TableParserConsumer for delivering filter information
 void setRecord(double ra, double dec, java.lang.String[] field)
          This method is called by the TableParser parser for each line of a DATA element.
 void setResourceInfo(java.lang.String name, java.lang.String contain)
          This method is called by the TableParser parser when elements in a RESOURCE tag are encountered (ex: <TITLE>...contain...
 void setTableInfo(java.lang.String name, java.lang.String value)
          This method is called by the TableParser parser when elements in a TABLE tag are encountered (ex: <TITLE>...contain...
 void setTableRaDecIndex(int nRa, int nDec)
          This method is called by the TableParser for transmitting the RA and DEC column indices found by the parse
 void setTarget(java.lang.String target)
          This method is called by the TableParser parser when the XML tag INFO ID="Target"... is encountered.
 void startResource(java.lang.String ID)
          This method is called by the TableParser parser when the XML tag is encountered.
 void startTable(java.lang.String ID)
          This method is called by the TableParser parser when the XML tag TABLE is encountered.
 void tableParserInfo(java.lang.String msg)
          This method is called by the TableParserConsumer for delivering parsing information
 void tableParserWarning(java.lang.String msg)
          This method is called by the TableParserConsumer for delivering not crucial error
 

Method Detail

startResource

void startResource(java.lang.String ID)
This method is called by the TableParser parser when the XML tag is encountered.

Parameters:
ID - the ID of the resource, or null if there isn't

setResourceInfo

void setResourceInfo(java.lang.String name,
                     java.lang.String contain)
This method is called by the TableParser parser when elements in a RESOURCE tag are encountered (ex: <TITLE>...contain...</TITLE>)

Parameters:
name - The name of the embedded element
contain - The contain of the embedded element

endResource

void endResource()
This method is called by the TableParser parser when the XML /RESOURCE is encountered.


startTable

void startTable(java.lang.String ID)
This method is called by the TableParser parser when the XML tag TABLE is encountered.

Parameters:
ID - the ID of the resource, or null if there isn't

setTableInfo

void setTableInfo(java.lang.String name,
                  java.lang.String value)
This method is called by the TableParser parser when elements in a TABLE tag are encountered (ex: <TITLE>...contain...</TITLE>)

Parameters:
name - The name of the embedded element
value - The contain of the embedded element

endTable

void endTable()
This method is called by the TableParser parser when the XML is encountered.


setTableRaDecIndex

void setTableRaDecIndex(int nRa,
                        int nDec)
This method is called by the TableParser for transmitting the RA and DEC column indices found by the parse

Parameters:
nRa - RA column index (0=first column)
nDec - DEC column index (0=first column)

setField

void setField(Field f)
This method is called by the TableParser parser when the XML /FIELD is encountered (the end of the element FIELD). ==> See Field object to have more details

Parameters:
f - the Field

setRecord

void setRecord(double ra,
               double dec,
               java.lang.String[] field)
This method is called by the TableParser parser for each line of a DATA element.

Parameters:
ra - the position of the astronomical object associated
dec -
field - each field of the line

setTarget

void setTarget(java.lang.String target)
This method is called by the TableParser parser when the XML tag INFO ID="Target"... is encountered.

Parameters:
target - the target of the table in ASU format (ex:001.286804+67.840004,bm=14.100000/14.1)

tableParserWarning

void tableParserWarning(java.lang.String msg)
This method is called by the TableParserConsumer for delivering not crucial error


tableParserInfo

void tableParserInfo(java.lang.String msg)
This method is called by the TableParserConsumer for delivering parsing information


setFilter

void setFilter(java.lang.String filter)
This method is called by the TableParserConsumer for delivering filter information



Copyright © 2009 UDS/CNRS