IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31101


Ignore:
Timestamp:
Mar 30, 2011, 2:58:06 PM (15 years ago)
Author:
rhenders
Message:

Now exporting VOTable format xml describing tables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/perl/pspsSchema2xml.pl

    r30186 r31101  
    5454print OUT "#define ".uc($enumsHeader)."_H\n\n";
    5555
    56 
     56# tables file
    5757my $tablesOutput = new IO::File(">tables.xml");
    5858my $tablesWriter = new XML::Writer(OUTPUT => $tablesOutput, DATA_MODE => 1, DATA_INDENT=>2);
     
    6060$tablesWriter->startTag('tableDescriptions', "type" => "$type");
    6161
     62# map file
    6263my $mapOutput = new IO::File(">map.xml");
    6364my $mapWriter = new XML::Writer(OUTPUT => $mapOutput, DATA_MODE => 1, DATA_INDENT=>2);
    6465$mapWriter->xmlDecl('UTF-8');
    6566$mapWriter->startTag('tabledata', "type" => "$type");
     67
     68# VOTable file
     69my $votOutput = new IO::File(">votable.xml");
     70my $votWriter = new XML::Writer(OUTPUT => $votOutput, DATA_MODE => 1, DATA_INDENT=>2);
     71$votWriter->xmlDecl('UTF-8');
     72$votWriter->startTag('VOTABLE', "version" => "1.1");
     73$votWriter->startTag('RESOURCE');
    6674
    6775if ($type eq "init") {createInit();}
     
    7886$mapWriter->endTag();
    7987$mapWriter->end();
     88
     89# finish up XML
     90$votWriter->endTag(); # end RESOURCE tag
     91$votWriter->endTag(); # end of TABLE tag
     92$votWriter->end();
    8093
    8194print OUT "\n#endif";
     
    214227            "name" => $tableNameOut,
    215228            "ippfitsextension" => "");
     229    $votWriter->startTag('TABLE',
     230            "name" => "$tableNameOut");
     231    $votWriter->dataElement('DESCRIPTION', "VOTable description of PSPS table $tableNameOut");
     232    $votWriter->startTag('PARAM',
     233            "arraysize" => "1",
     234            "datatype" => "char",
     235            "ucd" => "meta.bib.author",
     236            "name" => "Author",
     237            "value" => "PSPS");
     238    $votWriter->endTag();
    216239
    217240    open (SCHEMA, $path);
     
    258281    $tablesWriter->endTag();
    259282    $mapWriter->endTag();
    260     print OUT "} ".$tableNameOut.";\n";
     283
     284    $votWriter->startTag('DATA');
     285    $votWriter->startTag('TABLEDATA');
     286    $votWriter->endTag(); # end TABLEDDATA tag
     287        $votWriter->endTag(); # end DATA tag
     288        $votWriter->endTag(); # end TABLE tag
     289        print OUT "} ".$tableNameOut.";\n";
    261290
    262291    close SCHEMA;
     
    350379    $tablesWriter->endTag();
    351380
     381    # get VOTable type
     382    my $votType = "undef";
     383    if ($type eq "TBYTE") {$votType = "unsignedByte";}
     384    elsif ($type eq "TSHORT") {$votType = "short";}
     385    elsif ($type eq "TLONG") {$votType = "int";}
     386    elsif ($type eq "TLONGLONG") {$votType = "long";}
     387    elsif ($type eq "TFLOAT") {$votType = "float";}
     388    elsif ($type eq "TDOUBLE") {$votType = "double";}
     389    elsif ($type eq "TSTRING") {$votType = "char";}
     390
     391    $votWriter->startTag('FIELD',
     392            "name" => $name,
     393            "datatype" => $votType);
     394    $votWriter->endTag();
     395
    352396    $mapWriter->comment(" **MISSING** <map pspsName=\"$name\" ippType=\"$type\" ippName=\"\" comment=\"$comment\"/>");
    353397
Note: See TracChangeset for help on using the changeset viewer.