summaryrefslogtreecommitdiffstats
path: root/server/parser/xmlparser.h
blob: f2ce0570d8f27b1ef46db73fa2cff5c66846e6cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * Copyright (C) 2009 Red Hat Inc.
 *
 * David Sommerseth <davids@redhat.com>
 *
 *
 * This application is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; version 2.
 *
 * This application is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 */

/**
 * @file   xmlparser.h
 * @author David Sommerseth <davids@redhat.com>
 * @date   Wed Oct 7 17:27:39 2009
 *
 * @brief Parses summary.xml reports from rteval into a standardised XML format
 *        which is useful when putting data into a database.
 *
 */


#ifndef _XMLPARSER_H
#define _XMLPARSER_H

/**
 *  Parameters needed by the the xmlparser.xsl XSLT template.
 */
typedef struct {
        const char *table;            /**< Which table to parse data for.  Required*/
        unsigned int submid;          /**< Submission ID, needed by the 'rtevalruns' table */
        unsigned int syskey;          /**< System key (referencing systems.syskey) */
        const char *report_filename;  /**< Filename to the saved report (after being parsed) */
        unsigned int rterid;          /**< References rtevalruns.rterid */
} parseParams;


/**
 *  Database specific helper functions
 */
typedef struct {
        const char *(*dbh_FormatArray)(LogContext *log, xmlNode *sql_n); /** Formats data as arrays */
} dbhelper_func;

void init_xmlparser(dbhelper_func const * dbhelpers);
xmlDoc *parseToSQLdata(LogContext *log, xsltStylesheet *xslt, xmlDoc *indata_d, parseParams *params);
char *sqldataExtractContent(LogContext *log, xmlNode *sql_n);
int sqldataGetFid(LogContext *log, xmlNode *sqld, const char *fname);
char *sqldataGetValue(LogContext *log, xmlDoc *sqld, const char *fname, int recid);
xmlDoc *sqldataGetHostInfo(LogContext *log, xsltStylesheet *xslt, xmlDoc *summaryxml,
			   int syskey, char **hostname, char **ipaddr);
int sqldataGetRequiredSchemaVer(LogContext *log, xmlNode *sqldata_root);
#endif