[libvirt-users] domain schema fails to validate sysinfo element

I'm puzzled why virt-xml-checker rejects minimal config xml if it includes sysinfo element: <domain type='kvm'> <name>example</name> <sysinfo> </sysinfo> </domain> with the following error: Relax-NG validity error : Extra element sysinfo in interleave minimal.xml:3: element sysinfo: Relax-NG validity error : Element domain failed to validate content minimal.xml fails to validate I tried xmllint it gives the same output

On 13.10.2016 02:55, mordenkainen wrote:
I'm puzzled why virt-xml-checker rejects minimal config xml if it includes sysinfo element:
<domain type='kvm'> <name>example</name> <sysinfo> </sysinfo> </domain>
with the following error:
Relax-NG validity error : Extra element sysinfo in interleave minimal.xml:3: element sysinfo: Relax-NG validity error : Element domain failed to validate content minimal.xml fails to validate
Sigh. I wish libxml2 would report more sane error messages. But if we stretch it enough it can make sense. Just a little. Basically, this error message says, the problem is with sysinfo element. So opening up our RNG schema (docs/schemas/domaincommon.rng) you can search for conditions we put onto the element: <define name="sysinfo"> <element name="sysinfo"> <attribute name="type"> <value>smbios</value> </attribute> ... </element> </define> So, the element <sysinfo/> MUST have attribute named 'type' with value 'smbios'. Therefore if I fix your small XML: <domain type='kvm'> <name>example</name> <sysinfo type='smbios'> </sysinfo> </domain> it validates just fine. Michal
participants (2)
-
Michal Privoznik
-
mordenkainen