]> xenbits.xensource.com Git - libvirt.git/commitdiff
schema: Introduce schema for the news.xml file
authorPeter Krempa <pkrempa@redhat.com>
Tue, 28 Mar 2017 11:35:05 +0000 (13:35 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 3 Apr 2017 06:42:09 +0000 (08:42 +0200)
Since this file gets changed (and broken) rather often, introduce a
schema file so that the test suite can validate it.

docs/news.xml
docs/schemas/news.rng [new file with mode: 0644]
tests/virschematest.c

index db62279229b2f282b893aae37facb36ef771b128..014a439f199f5d871c59258b1db76bdba26308e0 100644 (file)
@@ -17,6 +17,8 @@
 
      Lines should be kept under 80 columns, and should not exceed 100 columns.
 
+     This file is validated against docs/schemas/news.rng schema.
+
      Use the following template to add a new release section:
 
   <release version="FIXME" date="unreleased">
diff --git a/docs/schemas/news.rng b/docs/schemas/news.rng
new file mode 100644 (file)
index 0000000..94a6870
--- /dev/null
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+  <start>
+    <ref name="libvirt"/>
+  </start>
+
+  <define name="libvirt">
+    <element name="libvirt">
+      <oneOrMore>
+        <ref name="release"/>
+      </oneOrMore>
+    </element>
+  </define>
+
+  <define name="release">
+    <element name="release">
+      <attribute name="version">
+        <data type="string">
+          <param name="pattern">v[0-9]+\.[0-9]+\.[0-9]+</param>
+        </data>
+      </attribute>
+      <attribute name="date">
+        <data type="string">
+          <param name="pattern">[0-9]{4}-[0-9]{2}-[0-9]{2}|unreleased</param>
+        </data>
+      </attribute>
+      <oneOrMore>
+        <ref name="section"/>
+      </oneOrMore>
+    </element>
+  </define>
+
+  <define name="section">
+    <element name="section">
+      <attribute name="title">
+        <data type="string"/>
+      </attribute>
+      <oneOrMore>
+        <ref name="change"/>
+      </oneOrMore>
+    </element>
+  </define>
+
+  <define name="change">
+    <element name="change">
+      <element name="summary">
+        <choice>
+          <data type="string">
+            <param name="pattern">\n[^\n]+\n +</param>
+          </data>
+          <empty/>
+        </choice>
+      </element>
+      <optional>
+        <element name="description">
+          <ref name="description"/>
+        </element>
+      </optional>
+    </element>
+  </define>
+
+  <define name="description">
+    <oneOrMore>
+      <choice>
+        <text/>
+        <element name="code">
+          <text/>
+        </element>
+      </choice>
+    </oneOrMore>
+  </define>
+
+</grammar>
index b73555da827177c3d47e235f41ac70b4c1b46ee5..4f194804afb302ddce80c1d57b708f6456cdb75d 100644 (file)
@@ -236,6 +236,8 @@ mymain(void)
     DO_TEST_DIR("storagevol.rng", "storagevolxml2xmlin", "storagevolxml2xmlout",
                 "storagevolschemadata");
 
+    DO_TEST_FILE("news.rng", "../docs/news.xml");
+
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }