[Libosinfo] [PATCH 1/4] schema: make various elements optional
Christophe Fergeau
cfergeau at redhat.com
Wed Oct 21 08:26:17 UTC 2015
Hey,
On Tue, Oct 20, 2015 at 02:02:33PM +0100, Daniel P. Berrange wrote:
> A number of places in the schema use <oneOrMore>. While this
> is correct when considering an XML file that defines a complete
> entity, it is incorrect for XML files that are just augmenting
> an existing entity. Change them to use <zeroOrMore> where we
> need to allow augmentation.
While these make sense in the context of augmentation, it also makes it
easy to write incomplete master files if you rely on the XML validation
to tell you that important nodes are missing (for example the shortid on
some of the nodes). I don't really have a better suggestion though, a
different rng for augmented files seem overkill...
Christophe
> ---
> data/schemas/libosinfo.rng | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng
> index b97e1cb..51eb80a 100644
> --- a/data/schemas/libosinfo.rng
> +++ b/data/schemas/libosinfo.rng
> @@ -48,7 +48,7 @@
> <ref name='url'/>
> </attribute>
> <interleave>
> - <oneOrMore>
> + <zeroOrMore>
> <element name='name'>
> <optional>
> <attribute name='xml:lang'>
> @@ -57,7 +57,7 @@
> </optional>
> <text/>
> </element>
> - </oneOrMore>
> + </zeroOrMore>
> <optional>
> <element name='bus-type'>
> <choice>
> @@ -129,7 +129,7 @@
>
> <define name="product-content">
> <interleave>
> - <oneOrMore>
> + <zeroOrMore>
> <element name='vendor'>
> <optional>
> <attribute name='xml:lang'>
> @@ -138,8 +138,8 @@
> </optional>
> <text/>
> </element>
> - </oneOrMore>
> - <oneOrMore>
> + </zeroOrMore>
> + <zeroOrMore>
> <element name='name'>
> <optional>
> <attribute name='xml:lang'>
> @@ -148,12 +148,12 @@
> </optional>
> <text/>
> </element>
> - </oneOrMore>
> - <oneOrMore>
> + </zeroOrMore>
> + <zeroOrMore>
> <element name='short-id'>
> <text/>
> </element>
> - </oneOrMore>
> + </zeroOrMore>
> <optional>
> <element name='version'>
> <text/>
> @@ -491,13 +491,13 @@
> <text/>
> </element>
> </zeroOrMore>
> - <oneOrMore>
> + <zeroOrMore>
> <element name='device'>
> <attribute name='id'>
> <ref name='url'/>
> </attribute>
> </element>
> - </oneOrMore>
> + </zeroOrMore>
> </element>
> </define>
>
> --
> 2.4.3
>
> _______________________________________________
> Libosinfo mailing list
> Libosinfo at redhat.com
> https://www.redhat.com/mailman/listinfo/libosinfo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20151021/6858a526/attachment.sig>
More information about the Libosinfo
mailing list