<grammar
  xmlns="http://relaxng.org/ns/structure/1.0"
  datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <!-- -*- xml -*-
  This is a RELAX NG schema for the output of 'virt-inspector'.

  To validate an existing document against this schema, you can
  use xmllint, like this:

    virt-inspector -d Foo > output.xml
    xmllint - -noout - -relaxng virt-inspector.rng output.xml

  (Note that because of limitations of XML, I have had to put spaces
  between double dashes in the above code.  Those spaces should not
  be there in what you type on the command line).

  Written by Richard W.M. Jones, with a little help from Daniel
  Veillard.

  This file can be freely copied and modified without restrictions.
  -->
  <start>
    <element name="operatingsystems">
      <oneOrMore>
        <element name="operatingsystem">
          <interleave>

            <optional><element name="root"><text/></element></optional>
            <ref name="osname"/>
            <optional><element name="arch"><text/></element></optional>
            <optional><ref name="osdistro"/></optional>
            <optional><element name="product_name"><text/></element></optional>
            <optional><element name="product_variant"><text/></element></optional>
            <element name="major_version"><text/></element>
            <element name="minor_version"><text/></element>
            <optional><element name="windows_systemroot"><text/></element></optional>
            <optional><element name="windows_current_control_set"><text/></element></optional>
            <optional><ref name="ospackageformat"/></optional>
            <optional><ref name="ospackagemanagement"/></optional>
            <optional><element name="hostname"><text/></element></optional>
            <optional><ref name="osformat"/></optional>
            <optional><element name="live"><empty/></element></optional>
            <optional><element name="netinst"><empty/></element></optional>
            <optional><element name="multipart"><empty/></element></optional>

            <ref name="mountpoints"/>
            <ref name="filesystems"/>
            <optional><ref name="drive_mappings"/></optional>
            <optional><ref name="applications"/></optional>

            <optional><element name="icon"><data type="base64Binary"/></element></optional>

          </interleave>
        </element>
      </oneOrMore>
    </element>
  </start>

  <!-- the operating system -->
  <define name="osname">
    <element name="name">
      <choice>
        <value>dos</value>
        <value>freebsd</value>
        <value>hurd</value>
        <value>linux</value>
        <value>minix</value>
        <value>netbsd</value>
        <value>openbsd</value>
        <value>windows</value>
        <!-- "unknown" is intentionally left out -->
      </choice>
    </element>
  </define>

  <!-- the distribution -->
  <define name="osdistro">
    <element name="distro">
      <choice>
        <value>alpinelinux</value>
        <value>altlinux</value>
        <value>archlinux</value>
        <value>buildroot</value>
        <value>centos</value>
        <value>cirros</value>
        <value>coreos</value>
        <value>debian</value>
        <value>fedora</value>
        <value>freebsd</value>
        <value>freedos</value>
        <value>frugalware</value>
        <value>gentoo</value>
        <value>linuxmint</value>
        <value>mageia</value>
        <value>mandriva</value>
        <value>meego</value>
        <value>netbsd</value>
        <value>openbsd</value>
        <value>opensuse</value>
        <value>oraclelinux</value>
        <value>pardus</value>
        <value>pldlinux</value>
        <value>redhat-based</value>
        <value>rhel</value>
        <value>scientificlinux</value>
        <value>slackware</value>
        <value>sles</value>
        <value>suse-based</value>
        <value>ttylinux</value>
        <value>ubuntu</value>
        <value>voidlinux</value>
        <value>windows</value>
        <!-- "unknown" is intentionally left out -->
      </choice>
    </element>
  </define>

  <!-- the package format -->
  <define name="ospackageformat">
    <element name="package_format">
      <choice>
        <value>apk</value>
        <value>deb</value>
        <value>ebuild</value>
        <value>pacman</value>
        <value>pisi</value>
        <value>pkgsrc</value>
        <value>rpm</value>
        <value>xbps</value>
        <!-- "unknown" is intentionally left out -->
      </choice>
    </element>
  </define>

  <!-- the package management -->
  <define name="ospackagemanagement">
    <element name="package_management">
      <choice>
        <value>apk</value>
        <value>apt</value>
        <value>dnf</value>
        <value>pacman</value>
        <value>pisi</value>
        <value>portage</value>
        <value>up2date</value>
        <value>urpmi</value>
        <value>xbps</value>
        <value>yum</value>
        <value>zypper</value>
        <!-- "unknown" is intentionally left out -->
      </choice>
    </element>
  </define>

  <!-- the operating system format -->
  <define name="osformat">
    <element name="format">
      <choice>
        <value>installed</value>
        <value>installer</value>
        <!-- "unknown" is intentionally left out -->
      </choice>
    </element>
  </define>

  <!-- how filesystems are mounted on mount points -->
  <define name="mountpoints">
    <element name="mountpoints">
      <oneOrMore>
        <element name="mountpoint">
          <attribute name="dev"><text/></attribute>
          <text/>
        </element>
      </oneOrMore>
    </element>
  </define>

  <!-- filesystems detected -->
  <define name="filesystems">
    <element name="filesystems">
      <oneOrMore>
        <element name="filesystem">
          <attribute name="dev"><text/></attribute>
          <interleave>
            <optional><element name="type"><text/></element></optional>
            <optional><element name="label"><text/></element></optional>
            <optional><element name="uuid"><text/></element></optional>
          </interleave>
        </element>
      </oneOrMore>
    </element>
  </define>

  <!-- drive mappings (for Windows) -->
  <define name="drive_mappings">
    <element name="drive_mappings">
      <oneOrMore>
        <element name="drive_mapping">
          <attribute name="name"><text/></attribute>
          <text/>
        </element>
      </oneOrMore>
    </element>
  </define>

  <!-- applications installed -->
  <define name="applications">
    <element name="applications">
      <zeroOrMore>
        <element name="application">
          <element name="name"><text/></element>
          <optional><element name="display_name"><text/></element></optional>
          <optional><element name="epoch"><text/></element></optional>
          <optional><element name="version"><text/></element></optional>
          <optional><element name="release"><text/></element></optional>
          <optional><element name="arch"><text/></element></optional>
          <optional><element name="install_path"><text/></element></optional>
          <optional><element name="publisher"><text/></element></optional>
          <optional><element name="url"><text/></element></optional>
          <optional><element name="source_package"><text/></element></optional>
          <optional><element name="summary"><text/></element></optional>
          <optional><element name="description"><text/></element></optional>
        </element>
      </zeroOrMore>
    </element>
  </define>

</grammar>
