On Wed, Jul 20, 2022 at 08:36:29AM +0200, Michal Privoznik wrote: > Currently, we have two types of output only XMLs: capabilities > and domaincapabilities. Neither of these is ever parsed. > Moreover, the order of elements inside these two documents is > well defined by their respective format functions. Therefore, > there's no need to have <interleave/> anywhere in their > corresponding schemas. The consumers of libvirt need to parse the XML, and they may wish to use the RNG files to validate. If the libvirt XML formatter has ever, or will ever, change ordering of elements, our RNG should be prepared for that. IOW, we should consider the RNG to be something that must validate XML output by all previous versions of libvirt. How confident can we be that we've never changed the order of any elements ? IMHO its best practice to always use <interleave/> > > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> > --- > src/conf/schemas/capability.rng | 160 +++++++++++++++----------------- > src/conf/schemas/domaincaps.rng | 80 ++++++++-------- > 2 files changed, 115 insertions(+), 125 deletions(-) > > diff --git a/src/conf/schemas/capability.rng b/src/conf/schemas/capability.rng > index c7e72c6f39..7a24b2a076 100644 > --- a/src/conf/schemas/capability.rng > +++ b/src/conf/schemas/capability.rng > @@ -53,44 +53,40 @@ > > <define name="secmodel"> > <element name="secmodel"> > - <interleave> > - <element name="model"> > - <text/> > - </element> > - <element name="doi"> > - <text/> > - </element> > - <zeroOrMore> > - <element name="baselabel"> > - <attribute name="type"> > - <text/> > - </attribute> > + <element name="model"> > + <text/> > + </element> > + <element name="doi"> > + <text/> > + </element> > + <zeroOrMore> > + <element name="baselabel"> > + <attribute name="type"> > <text/> > - </element> > - </zeroOrMore> > - </interleave> > + </attribute> > + <text/> > + </element> > + </zeroOrMore> > </element> > </define> > > <define name="power_management"> > <element name="power_management"> > - <interleave> > - <optional> > - <element name="suspend_mem"> > - <empty/> > - </element> > - </optional> > - <optional> > - <element name="suspend_disk"> > - <empty/> > - </element> > - </optional> > - <optional> > - <element name="suspend_hybrid"> > - <empty/> > - </element> > - </optional> > - </interleave> > + <optional> > + <element name="suspend_mem"> > + <empty/> > + </element> > + </optional> > + <optional> > + <element name="suspend_disk"> > + <empty/> > + </element> > + </optional> > + <optional> > + <element name="suspend_hybrid"> > + <empty/> > + </element> > + </optional> > </element> > </define> > > @@ -442,57 +438,55 @@ > > <define name="features"> > <element name="features"> > - <interleave> > - <optional> > - <element name="pae"> > - <empty/> > - </element> > - </optional> > - <optional> > - <element name="nonpae"> > - <empty/> > - </element> > - </optional> > - <optional> > - <element name="ia64_be"> > - <empty/> > - </element> > - </optional> > - <optional> > - <element name="acpi"> > - <ref name="featuretoggle"/> > - <empty/> > - </element> > - </optional> > - <optional> > - <element name="apic"> > - <ref name="featuretoggle"/> > - <empty/> > - </element> > - </optional> > - <optional> > - <element name="cpuselection"> > - <empty/> > - </element> > - </optional> > - <optional> > - <element name="deviceboot"> > - <empty/> > - </element> > - </optional> > - <optional> > - <element name="disksnapshot"> > - <ref name="featuretoggle"/> > - <empty/> > - </element> > - </optional> > - <optional> > - <element name="hap"> > - <ref name="featuretoggle"/> > - <empty/> > - </element> > - </optional> > - </interleave> > + <optional> > + <element name="pae"> > + <empty/> > + </element> > + </optional> > + <optional> > + <element name="nonpae"> > + <empty/> > + </element> > + </optional> > + <optional> > + <element name="ia64_be"> > + <empty/> > + </element> > + </optional> > + <optional> > + <element name="acpi"> > + <ref name="featuretoggle"/> > + <empty/> > + </element> > + </optional> > + <optional> > + <element name="apic"> > + <ref name="featuretoggle"/> > + <empty/> > + </element> > + </optional> > + <optional> > + <element name="cpuselection"> > + <empty/> > + </element> > + </optional> > + <optional> > + <element name="deviceboot"> > + <empty/> > + </element> > + </optional> > + <optional> > + <element name="disksnapshot"> > + <ref name="featuretoggle"/> > + <empty/> > + </element> > + </optional> > + <optional> > + <element name="hap"> > + <ref name="featuretoggle"/> > + <empty/> > + </element> > + </optional> > </element> > </define> > > diff --git a/src/conf/schemas/domaincaps.rng b/src/conf/schemas/domaincaps.rng > index 9cbc2467ab..331fdbb1e9 100644 > --- a/src/conf/schemas/domaincaps.rng > +++ b/src/conf/schemas/domaincaps.rng > @@ -10,43 +10,41 @@ > > <define name="domainCapabilities"> > <element name="domainCapabilities"> > - <interleave> > - <element name="path"> > - <ref name="absFilePath"/> > - </element> > - <element name="domain"> > - <text/> > - </element> > - <optional> > - <element name="machine"> > - <text/> > - </element> > - </optional> > - <element name="arch"> > + <element name="path"> > + <ref name="absFilePath"/> > + </element> > + <element name="domain"> > + <text/> > + </element> > + <optional> > + <element name="machine"> > <text/> > </element> > - <optional> > - <ref name="vcpu"/> > - </optional> > - <optional> > - <ref name="iothreads"/> > - </optional> > - <optional> > - <ref name="os"/> > - </optional> > - <optional> > - <ref name="cpu"/> > - </optional> > - <optional> > - <ref name="memoryBacking"/> > - </optional> > - <optional> > - <ref name="devices"/> > - </optional> > - <optional> > - <ref name="features"/> > - </optional> > - </interleave> > + </optional> > + <element name="arch"> > + <text/> > + </element> > + <optional> > + <ref name="vcpu"/> > + </optional> > + <optional> > + <ref name="iothreads"/> > + </optional> > + <optional> > + <ref name="os"/> > + </optional> > + <optional> > + <ref name="cpu"/> > + </optional> > + <optional> > + <ref name="memoryBacking"/> > + </optional> > + <optional> > + <ref name="devices"/> > + </optional> > + <optional> > + <ref name="features"/> > + </optional> > </element> > </define> > > @@ -78,13 +76,11 @@ > > <define name="os"> > <element name="os"> > - <interleave> > - <ref name="supported"/> > - <ref name="enum"/> > - <optional> > - <ref name="loader"/> > - </optional> > - </interleave> > + <ref name="supported"/> > + <ref name="enum"/> > + <optional> > + <ref name="loader"/> > + </optional> > </element> > </define> > > -- > 2.35.1 > With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|