Skip to content

Commit c58939c

Browse files
committed
XML output modified to enable proper validation
XML document header modified so that it can be validated against the XSD document. Also always use cpu-load header for CPU activity (cpu-load-all has been removed). Signed-off-by: Sebastien GODARD <[email protected]>
1 parent 7a81a28 commit c58939c

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

sadf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "sa.h"
1010

1111
/* DTD version for XML output */
12-
#define XML_DTD_VERSION "2.19"
12+
#define XML_DTD_VERSION "3.0"
1313

1414
/* Possible actions for functions used to display reports */
1515
#define F_BEGIN 0x01

sadf_misc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,10 @@ __printf_funct_t print_xml_header(int *tab, int action, char *dfile,
500500
printf("\"http://pagesperso-orange.fr/sebastien.godard/sysstat-%s.dtd\">\n",
501501
XML_DTD_VERSION);
502502

503-
xprintf(*tab, "<sysstat>");
503+
xprintf(*tab, "<sysstat\n"
504+
"xmlns=\"http://pagesperso-orange.fr/sebastien.godard/sysstat\"\n"
505+
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
506+
"xsi:schemaLocation=\"http://pagesperso-orange.fr/sebastien.godard sysstat.xsd\">");
504507

505508
xprintf(++(*tab), "<sysdata-version>%s</sysdata-version>",
506509
XML_DTD_VERSION);

xml_stats.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,7 @@ __print_funct_t xml_print_cpu_stats(struct activity *a, int curr, int tab,
112112
struct stats_cpu *scc, *scp;
113113
char cpuno[8];
114114

115-
if (DISPLAY_CPU_DEF(a->opt_flags)) {
116-
xprintf(tab++, "<cpu-load>");
117-
}
118-
else if (DISPLAY_CPU_ALL(a->opt_flags)) {
119-
xprintf(tab++, "<cpu-load-all>");
120-
}
115+
xprintf(tab++, "<cpu-load>");
121116

122117
for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
123118

@@ -251,12 +246,7 @@ __print_funct_t xml_print_cpu_stats(struct activity *a, int curr, int tab,
251246
}
252247
}
253248

254-
if (DISPLAY_CPU_DEF(a->opt_flags)) {
255-
xprintf(--tab, "</cpu-load>");
256-
}
257-
else if (DISPLAY_CPU_ALL(a->opt_flags)) {
258-
xprintf(--tab, "</cpu-load-all>");
259-
}
249+
xprintf(--tab, "</cpu-load>");
260250
}
261251

262252
/*

0 commit comments

Comments
 (0)