schema: Add define for object names

Objects such as domain, pool, etc re-define the regex for the format.
Add more generic types for objects with/without a slash which we'll be
able to reuse also for other objects.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-01-06 16:51:21 +01:00
parent e955106195
commit 1a3c07989b
4 changed files with 20 additions and 20 deletions

View File

@ -261,6 +261,19 @@
</choice> </choice>
</define> </define>
<!-- objectName represents any generic string for naming objects like domain -->
<define name="objectNameWithSlash">
<data type="string">
<param name="pattern">[^\n]+</param>
</data>
</define>
<define name="objectName">
<data type="string">
<param name="pattern">[^/\n]+</param>
</data>
</define>
<define name="genericName"> <define name="genericName">
<data type="string"> <data type="string">
<param name="pattern">[a-zA-Z0-9_\+\-]+</param> <param name="pattern">[a-zA-Z0-9_\+\-]+</param>

View File

@ -18,9 +18,7 @@
<define name="title"> <define name="title">
<element name="title"> <element name="title">
<data type="string"> <ref name="objectNameWithSlash"/>
<param name="pattern">[^\n]+</param>
</data>
</element> </element>
</define> </define>
@ -559,7 +557,7 @@
</optional> </optional>
<interleave> <interleave>
<element name="name"> <element name="name">
<ref name="domainName"/> <ref name="objectNameWithSlash"/>
</element> </element>
<optional> <optional>
<element name="uuid"> <element name="uuid">
@ -1391,7 +1389,7 @@
<optional> <optional>
<element name="backenddomain"> <element name="backenddomain">
<attribute name="name"> <attribute name="name">
<ref name="domainName"/> <ref name="objectNameWithSlash"/>
</attribute> </attribute>
<empty/> <empty/>
</element> </element>
@ -2056,7 +2054,7 @@
<element name="source"> <element name="source">
<interleave> <interleave>
<attribute name="pool"> <attribute name="pool">
<ref name="poolName"/> <ref name="objectName"/>
</attribute> </attribute>
<attribute name="volume"> <attribute name="volume">
<ref name="volName"/> <ref name="volName"/>
@ -3269,7 +3267,7 @@
<optional> <optional>
<element name="backenddomain"> <element name="backenddomain">
<attribute name="name"> <attribute name="name">
<ref name="domainName"/> <ref name="objectNameWithSlash"/>
</attribute> </attribute>
<empty/> <empty/>
</element> </element>
@ -6944,11 +6942,6 @@
<param name="maxInclusive">1000</param> <param name="maxInclusive">1000</param>
</data> </data>
</define> </define>
<define name="domainName">
<data type="string">
<param name="pattern">[^\n]+</param>
</data>
</define>
<define name="diskSerial"> <define name="diskSerial">
<data type="string"> <data type="string">
<param name="pattern">[A-Za-z0-9_\.\+\- ]+</param> <param name="pattern">[A-Za-z0-9_\.\+\- ]+</param>

View File

@ -6,12 +6,6 @@
<!-- This schema is not designed for standalone use; another file <!-- This schema is not designed for standalone use; another file
must include both this file and basictypes.rng --> must include both this file and basictypes.rng -->
<define name="poolName">
<data type="string">
<param name="pattern">[^/\n]+</param>
</data>
</define>
<define name="encryption"> <define name="encryption">
<element name="encryption"> <element name="encryption">
<attribute name="format"> <attribute name="format">

View File

@ -247,7 +247,7 @@
<interleave> <interleave>
<optional> <optional>
<element name="name"> <element name="name">
<ref name="poolName"/> <ref name="objectName"/>
</element> </element>
</optional> </optional>
<optional> <optional>
@ -261,7 +261,7 @@
<define name="commonmetadata"> <define name="commonmetadata">
<interleave> <interleave>
<element name="name"> <element name="name">
<ref name="poolName"/> <ref name="objectName"/>
</element> </element>
<optional> <optional>
<element name="uuid"> <element name="uuid">