[buoh/comic-validation] Validate comics.xml
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [buoh/comic-validation] Validate comics.xml
- Date: Thu, 20 Sep 2018 22:40:14 +0000 (UTC)
commit b49e5e521006543f8b62fd66cb53bef6dc9286f3
Author: Jan Tojnar <jtojnar gmail com>
Date: Fri Sep 21 00:30:30 2018 +0200
Validate comics.xml
data/comic_list.xsd | 30 ++++++++++++++++++++++++++++++
data/meson.build | 11 ++++++++++-
meson.build | 1 +
3 files changed, 41 insertions(+), 1 deletion(-)
---
diff --git a/data/comic_list.xsd b/data/comic_list.xsd
new file mode 100644
index 0000000..297e820
--- /dev/null
+++ b/data/comic_list.xsd
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="comic_list">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" name="comic">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="7" minOccurs="0" name="restrict" type="xs:int"/>
+ </xs:sequence>
+ <xs:attribute name="author" type="xs:string"/>
+ <xs:attribute name="class">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="date"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="first" type="xs:date"/>
+ <xs:attribute name="generic_uri" type="xs:string"/>
+ <xs:attribute name="id" type="xs:ID" use="required"/>
+ <xs:attribute name="language" type="xs:string"/>
+ <xs:attribute name="offset" type="xs:string"/>
+ <xs:attribute name="title" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/data/meson.build b/data/meson.build
index 57ea5b7..1834bf1 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -32,10 +32,19 @@ if desktop_file_validate.found()
)
endif
+comics = 'comics.xml'
install_data(
- 'comics.xml',
+ comics,
install_dir: comicsdir,
)
+if xmllint.found()
+ test(
+ 'Validating @0@'.format(comics),
+ xmllint,
+ args: ['--noout', '--schema', 'comic_list.xsd', comics],
+ workdir: meson.current_source_dir(),
+ )
+endif
gnome.mkenums(
'org.gnome.buoh.enums.xml',
diff --git a/meson.build b/meson.build
index c7a4535..98f37f0 100644
--- a/meson.build
+++ b/meson.build
@@ -28,6 +28,7 @@ libxml2 = dependency('libxml-2.0', version: '>= 2.4.0')
desktop_file_validate = find_program('desktop-file-validate', required: false)
gtk_builder_tool = find_program('gtk-builder-tool', required: false)
+xmllint = find_program('xmllint', required: false)
buoh_deps = [
gtk,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]