On 08/29/2011 02:27 PM, "Jürgen Heinemann (Undefined)" wrote:
> Hallo Sebastian,
> I have found some bugs with sadf -x command.
> You can see my changes in sysstat-10.0.2.rc1.diff attachment.
> The Doctype Declaration in sadf_misc.c isn't set to "sysstat" rootNode
> and timetamp Element closed with child Elements
> See my Example xslt
>
> sadf -P 0,1 -x > input.xml
> xsltproc --encoding utf-8 --novalid sysstat.xslt input.xml
>
> greets Jürgen
/**
* @file sysstat-10.0.2.rc1.diff
* @author Juergen Heinemann (Undefined) http://www.hjcms.de
* @since Mon Aug 29 14:11:17 CEST 2011
* @short diff options:-Nau6
*/
--- ./xml/sysstat.xsd.orig 2011-08-29 13:42:49.
124597092 +0200
+++ ./xml/sysstat.xsd 2011-08-29 13:43:54.
065167625 +0200
@@ -40,13 +40,13 @@
<xs:element name="release" type="release-type"></xs:element>
<xs:simpleType name="release-type">
<xs:restriction base="xs:string"></xs:restriction>
</xs:simpleType>
-<xs:element name=machine"" type="machine-type"></xs:element>
+<xs:element name="machine" type="machine-type"></xs:element>
<xs:simpleType name="machine-type">
<xs:restriction base="xs:string"></xs:restriction>
</xs:simpleType>
<xs:element name="file-date" type="file-date-type"></xs:element>
<xs:simpleType name="file-date-type">
@@ -284,17 +284,16 @@
<xs:element name="hugused-percent" type="hundredth-type"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:element name="kernel" type="kernel-type"></xs:element>
<xs:complexType name="kernel-type">
- <xs:attribute name="dentunusd" type="xs:nonNegativeInteger">
- <xs:attribute name="file-nr" type="xs:nonNegativeInteger">
- <xs:attribute name="inode-nr" type="xs:nonNegativeInteger">
- <xs:attribute name="pty-nr" type="xs:nonNegativeInteger">
- </xs:attribute>
+ <xs:attribute name="dentunusd" type="xs:nonNegativeInteger"></xs:attribute>
+ <xs:attribute name="file-nr" type="xs:nonNegativeInteger"></xs:attribute>
+ <xs:attribute name="inode-nr" type="xs:nonNegativeInteger"></xs:attribute>
+ <xs:attribute name="pty-nr" type="xs:nonNegativeInteger"></xs:attribute>
</xs:complexType>
<xs:element name="queue" type="queue-type"></xs:element>
<xs:complexType name="queue-type">
<xs:attribute name="runq-sz" type="xs:nonNegativeInteger"></xs:attribute>
<xs:attribute name="plist-sz" type="xs:nonNegativeInteger"></xs:attribute>
--- ./xml/sysstat.dtd.orig 2011-08-29 14:00:46.
827833320 +0200
+++ ./xml/sysstat.dtd 2011-08-29 14:10:59.
347827319 +0200
@@ -2,13 +2,16 @@
<!--DTD v2.12 for sysstat. See sadf.h -->
<!ELEMENT sysstat (sysdata-version, host)>
<!ELEMENT sysdata-version (#PCDATA)>
-<!ELEMENT host (sysname, release, machine, number-of-cpus, file-date, statistics, restarts, comments)>
+<!ENTITY % TIMESTAMP_ELEMENTS "cpu-load|cpu-load-all|process-and-context-switch|interrupts|swap-pages|paging|io|memory|hugepages|kernel|queue|serial|disk|network|power-management">
+<!ENTITY % HOST_ELEMENTS "sysname|release|machine|number-of-cpus|file-date|statistics|restarts|comments">
+
+<!ELEMENT host (%HOST_ELEMENTS;)+>
<!ATTLIST host
nodename CDATA #REQUIRED
>
<!ELEMENT sysname (#PCDATA)>
@@ -19,13 +22,13 @@
<!ELEMENT number-of-cpus (#PCDATA)>
<!ELEMENT file-date (#PCDATA)>
<!ELEMENT statistics (timestamp+)>
-<!ELEMENT timestamp (cpu-load, cpu-load-all, process-and-context-switch, interrupts, swap-pages, paging, io, memory, hugepages, kernel, queue, serial, disk, network, power-management)>
+<!ELEMENT timestamp (%TIMESTAMP_ELEMENTS;)+>
<!ATTLIST timestamp
date CDATA #REQUIRED
time CDATA #REQUIRED
utc CDATA #REQUIRED
interval CDATA #REQUIRED
>
--- ./sadf_misc.c.orig 2011-08-29 13:54:54.
673109443 +0200
+++ ./sadf_misc.c 2011-08-29 14:02:55.
640212688 +0200
@@ -285,13 +285,13 @@
***************************************************************************
*/
__printf_funct_t print_xml_timestamp(int *tab, int action, char *cur_date,
char *cur_time, int utc, unsigned long long itv)
{
if (action & F_BEGIN) {
- xprintf(*tab, "<timestamp date=\"%s\" time=\"%s\" utc=\"%d\" interval=\"%llu\"/>",
+ xprintf(*tab, "<timestamp date=\"%s\" time=\"%s\" utc=\"%d\" interval=\"%llu\">",
cur_date, cur_time, utc ? 1 : 0, itv);
}
if (action & F_END) {
xprintf(--(*tab), "</timestamp>");
}
}
sysstat.xslt:
============
<?xml version = '1.0' encoding = 'utf-8' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Vorgefertigte templates und Helferlein -->
<xsl:output version="1.0"
method="xml"
encoding="utf-8"
indent="yes"
media-type="text/xml"
/>
<xsl:template match="*" mode="xml">
<xsl:element name="{name()}">
<xsl:for-each select="@*">
<xsl:attribute name="{name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates select="./*|text()" mode="xml" />
</xsl:element>
</xsl:template>
<xsl:template match="sysstat">
<xsl:apply-templates match="." mode="xml" />
</xsl:template>
</xsl:stylesheet>
Changes:
xxxx/xx/xx: Version 10.0.3 - Sebastien Godard (sysstat <at> orange.fr)
+ * [Jürgen Heinemann]: Fixed a bug in sadf XML output.
+ * [Jürgen Heinemann]: Fixed several bugs in DTD and XSD
+ documents.
+ * CREDITS file updated.
2011/08/28: Version 10.0.2 - Sebastien Godard (sysstat <at> orange.fr)
* sadf modified to make it easier to add new output formats.
David Gesswein <djg@drs[...].com>
Ladislav Hagara <ladislav.hagara@uno[...].cz>
Don Harrop <don@swb[...].com>
+ Jürgen Heinemann <heinemann.juergen@hjc[...].de>
Kei Ishida <ishida.kei@oss[...].jp>
Tatsuo Ito <tito@mir[...].com>
David S. Jackson <dsj@syl[...].net>
#include "sa.h"
/* DTD version for XML output */
-#define XML_DTD_VERSION "2.12"
+#define XML_DTD_VERSION "2.13"
/* Possible actions for functions used to display reports */
#define F_BEGIN 0x01
char *cur_time, int utc, unsigned long long itv)
{
if (action & F_BEGIN) {
- xprintf(*tab, "<timestamp date=\"%s\" time=\"%s\" utc=\"%d\" interval=\"%llu\"/>",
+ xprintf(*tab, "<timestamp date=\"%s\" time=\"%s\" utc=\"%d\" interval=\"%llu\">",
cur_date, cur_time, utc ? 1 : 0, itv);
}
if (action & F_END) {
if (action & F_BEGIN) {
printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- printf("<!DOCTYPE Configure PUBLIC \"DTD v%s sysstat //EN\"\n",
+ printf("<!DOCTYPE sysstat PUBLIC \"DTD v%s sysstat //EN\"\n",
XML_DTD_VERSION);
printf("\"http://pagesperso-orange.fr/sebastien.godard/sysstat.dtd\">\n");
<?xml version="1.0" encoding="UTF-8"?>
-<!--DTD v2.12 for sysstat. See sadf.h -->
+<!--DTD v2.13 for sysstat. See sadf.h -->
<!ELEMENT sysstat (sysdata-version, host)>
<!ELEMENT sysdata-version (#PCDATA)>
-<!ELEMENT host (sysname, release, machine, number-of-cpus, file-date, statistics, restarts, comments)>
+<!ENTITY % TIMESTAMP_ELEMENTS "cpu-load|cpu-load-all|process-and-context-switch|interrupts|swap-pages|paging|io|memory|hugepages|kernel|queue|serial|disk|network|power-management">
+<!ENTITY % HOST_ELEMENTS "sysname|release|machine|number-of-cpus|file-date|statistics|restarts|comments">
+
+<!ELEMENT host (%HOST_ELEMENTS;)+>
<!ATTLIST host
nodename CDATA #REQUIRED
>
<!ELEMENT statistics (timestamp+)>
-<!ELEMENT timestamp (cpu-load, cpu-load-all, process-and-context-switch, interrupts, swap-pages, paging, io, memory, hugepages, kernel, queue, serial, disk, network, power-management)>
+<!ELEMENT timestamp (%TIMESTAMP_ELEMENTS;)+>
<!ATTLIST timestamp
date CDATA #REQUIRED
time CDATA #REQUIRED
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://pagesperso-orange.fr/sebastien.godard/sysstat" targetNamespace="http://pagesperso-orange.fr/sebastien.godard/sysstat" elementFormDefault="qualified">
<xs:annotation>
- <xs:appinfo>-- XML Schema v2.12 for sysstat. See sadf.h --</xs:appinfo>
+ <xs:appinfo>-- XML Schema v2.13 for sysstat. See sadf.h --</xs:appinfo>
</xs:annotation>
<xs:element name="sysstat" type="sysstat-type"></xs:element>
<xs:restriction base="xs:string"></xs:restriction>
</xs:simpleType>
-<xs:element name=machine"" type="machine-type"></xs:element>
+<xs:element name="machine" type="machine-type"></xs:element>
<xs:simpleType name="machine-type">
<xs:restriction base="xs:string"></xs:restriction>
</xs:simpleType>
<xs:element name="kernel" type="kernel-type"></xs:element>
<xs:complexType name="kernel-type">
- <xs:attribute name="dentunusd" type="xs:nonNegativeInteger">
- <xs:attribute name="file-nr" type="xs:nonNegativeInteger">
- <xs:attribute name="inode-nr" type="xs:nonNegativeInteger">
- <xs:attribute name="pty-nr" type="xs:nonNegativeInteger">
- </xs:attribute>
+ <xs:attribute name="dentunusd" type="xs:nonNegativeInteger"></xs:attribute>
+ <xs:attribute name="file-nr" type="xs:nonNegativeInteger"></xs:attribute>
+ <xs:attribute name="inode-nr" type="xs:nonNegativeInteger"></xs:attribute>
+ <xs:attribute name="pty-nr" type="xs:nonNegativeInteger"></xs:attribute>
</xs:complexType>
<xs:element name="queue" type="queue-type"></xs:element>