Re: [PATCH 1/4] schema: make various elements optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libosinfo

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux