From 369cdfa8f54c9848cc44327fb9b2bb67e01def8a Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 14 Apr 2014 16:54:15 -0600 Subject: [PATCH] conf: set up for per-grammar overrides in schemas This patch is my first experience playing with nested grammars, as documented in http://relaxng.org/tutorial-20011203.html#IDA3PZR. I plan on doing more overrides in order to make the RelaxNG grammar mirror the C code refactoring into a common virStorageSource, but where different clients of that source do not support the same subset of functionality. By starting with something fairly easy to validate, I can make sure my later patches will be possible. This patch adds a use of the no-op to the disksnapshot definition, so that the snapshot version of a type='file' more closely resembles the version in domaincommon. A future patch will merge the two files into using a common define, but this patch is sufficient for testing that adding in any of the tests/domainsnapshotxml2xmlin/*.xml files still gets rejected unless it occurs within the subelement, because the definition of startupPolicy is empty outside of domain.rng. * docs/schemas/storagecommon.rng (storageStartupPolicy) (storageSourceExtra): Create no-op defaults. * docs/schemas/domainsnapshot.rng (domain): Use nested grammar to avoid restricting . (storageSourceExtra): Create new override. (disksnapshot): Access overrides through common names. * docs/schemas/domaincommon.rng (disk): Access overrides through common names. * docs/schemas/domain.rng (storageStartupPolicy) (storageSourceExtra): Create new overrides. Signed-off-by: Eric Blake Signed-off-by: Jiri Denemark --- docs/schemas/domain.rng | 14 ++++++++++++- docs/schemas/domaincommon.rng | 11 +++++----- docs/schemas/domainsnapshot.rng | 21 +++++++++++++++---- docs/schemas/storagecommon.rng | 14 +++++++++++++ .../domainsnapshotxml2xmlin/disk-invalid.xml | 10 +++++++++ 5 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 tests/domainsnapshotxml2xmlin/disk-invalid.xml diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index cf0be68c27..114b87e261 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -1,9 +1,21 @@ - + + + + + + + + + + + + diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 59f3fdd525..df2c839e34 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1213,7 +1213,7 @@ - + @@ -1235,7 +1235,7 @@ - + @@ -1255,7 +1255,7 @@ - + @@ -1296,7 +1296,7 @@ - + @@ -1306,10 +1306,11 @@ - + + diff --git a/docs/schemas/domainsnapshot.rng b/docs/schemas/domainsnapshot.rng index 644da90f9c..bec12dbe24 100644 --- a/docs/schemas/domainsnapshot.rng +++ b/docs/schemas/domainsnapshot.rng @@ -75,7 +75,12 @@ - + + + + @@ -102,6 +107,11 @@ + + + + + @@ -138,10 +148,13 @@ + + + - + @@ -157,7 +170,7 @@ - + @@ -170,7 +183,7 @@ - + diff --git a/docs/schemas/storagecommon.rng b/docs/schemas/storagecommon.rng index 1015e8d334..06b2f81fde 100644 --- a/docs/schemas/storagecommon.rng +++ b/docs/schemas/storagecommon.rng @@ -79,4 +79,18 @@ + + + + + + + + + + diff --git a/tests/domainsnapshotxml2xmlin/disk-invalid.xml b/tests/domainsnapshotxml2xmlin/disk-invalid.xml new file mode 100644 index 0000000000..6d2bea4b97 --- /dev/null +++ b/tests/domainsnapshotxml2xmlin/disk-invalid.xml @@ -0,0 +1,10 @@ + + asdf + adsf + + + + + + +