IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 28, 2010, 4:26:47 PM (16 years ago)
Author:
rhenders
Message:

Now storing results in XML format

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/src/ippToPsps.c

    r28249 r28529  
    5353    }
    5454
     55    // save XML document for results
     56    if (this->resultsXmlDoc) {
     57   
     58        xmlSaveFormatFileEnc(this->resultsPath, this->resultsXmlDoc, "UTF-8", 1);
     59
     60        xmlFreeDoc(this->resultsXmlDoc);
     61        xmlCleanupParser();
     62        xmlMemoryDump();
     63    }
     64
    5565    psFree(this->fitsInPath);
    5666    psFree(this->resultsPath);
     
    5969    psFree(this->pmconfig);
    6070
    61     if (this->resultsFile) fclose(this->resultsFile);
    6271
    6372    for(uint32_t i=0; i<this->numOfInputFiles; i++)
     
    246255    this->fitsInPath = NULL;
    247256    this->resultsPath = NULL;
    248     this->resultsFile = NULL;
     257    this->resultsXmlDoc = NULL;
    249258    this->numOfInputFiles = 0;
    250259    this->inputFiles = NULL;
     
    304313    }
    305314
     315    // create a config object
    306316    this->config = ippToPspsConfig_Constructor(this->configsDir);
    307317    if (this->config == NULL) {
     
    311321    }
    312322
    313     // ready results file, if necessary
     323    // create XML document for results
    314324    if (this->resultsPath) {
    315325
    316         this->resultsFile = fopen (this->resultsPath, "w+");
    317 
    318         if (this->resultsFile == NULL) {
    319 
    320             psError(PS_ERR_UNKNOWN, false, "Unable to open results file at %s", this->resultsPath);
    321             // not essential to write results, so don't bail out
    322         }
    323         else {
    324             if (fprintf(this->resultsFile, "%s\n", outputName) < 1 )     
    325                 psError(PS_ERR_IO, false, "Unable to write FITS output filename to'%s'\n", this->resultsPath);
    326         }
     326        this->resultsXmlDoc = xmlNewDoc(BAD_CAST "1.0");
     327        xmlNodePtr rootNode = xmlNewNode(NULL, BAD_CAST "ippToPsps_Results");
     328        xmlDocSetRootElement(this->resultsXmlDoc, rootNode);
     329        xmlNewChild(rootNode, NULL, BAD_CAST "filename", BAD_CAST outputName);
    327330    }
    328331
Note: See TracChangeset for help on using the changeset viewer.