pelican/utility/src/Config.cpp
/**
 * @details
 * Read a configuration from the Pelican XML file specified when the
 * configuration object is instantiated.
 */
@details
Read a configuration from the Pelican XML file specified when the
configuration object is instantiated.
@details Read a configuration from the Pelican XML file specified when the configuration object is instantiated .
QDomDocument Config::read(const QString& fileName)
{
    QDomDocument document("pelican");
    if (fileName.isEmpty()) return document;
    QFile file(fileName);
    if (!file.open(QFile::ReadOnly | QFile::Text))
        throw QString("Config::read(): Cannot open file '%1'").arg(fileName);
    QString error;
    int line, column;
    if (!document.setContent(&file, true, &error, &line, &column)) {
        throw QString("Config::read(): Parse error "
                "(Line: %1 Col: %2): %3.").arg(line).arg(column).arg(error);
    }
    if (document.doctype().name() != "pelican")
        throw QString("Config::read(): Invalid doctype (must be 'pelican').");
    preprocess(document);
    return document;
}
QDomDocument Config :: read ( const QString & fileName ) { QDomDocument document ( " " ) ; if ( fileName . isEmpty ( ) ) return document ; QFile file ( fileName ) ; if ( ! file . open ( QFile :: ReadOnly | QFile :: Text ) ) throw QString ( " " ) . arg ( fileName ) ; QString error ; int line , column ; if ( ! document . setContent ( & file , true , & error , & line , & column ) ) { throw QString ( " " " " ) . arg ( line ) . arg ( column ) . arg ( error ) ; } if ( document . doctype ( ) . name ( ) != " " ) throw QString ( " " ) ; preprocess ( document ) ; return document ; }
@details
 Read a configuration from the Pelican XML file specified when the
 configuration object is instantiated.
@details Read a configuration from the Pelican XML file specified when the configuration object is instantiated .
// Read the XML configuration file into the QDomDocument. // Pre-process and return the document.