schema: Introduce schema for the news.xml file

Since this file gets changed (and broken) rather often, introduce a
schema file so that the test suite can validate it.
This commit is contained in:
Peter Krempa 2017-03-28 13:35:05 +02:00
parent 7bbdb29ce6
commit fe26b28564
3 changed files with 77 additions and 0 deletions

View 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">

73
docs/schemas/news.rng Normal file
View File

@ -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>

View 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;
}