Hello.

I'm trying to apply an XML Schema to a series of checks.
Specifically, I define the branches it may have and a number of restrictions.

To determine the different branches it may have, I have written the following code:

Code:
  <xs:element name="vm">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" ref="filesystem"/>
        <!--xs:element ref="dynamips_conf" minOccurs="0" /-->
        <xs:element minOccurs="0" ref="mem"/>
        <xs:element minOccurs="0" ref="kernel"/>
        <xs:element minOccurs="0" ref="conf"/>
        <xs:element minOccurs="0" ref="shell"/>
        <xs:element minOccurs="0" ref="basedir"/>
        <xs:element minOccurs="0" ref="mng_if"/>
        <xs:element maxOccurs="unbounded" minOccurs="0" ref="console"/>
        <xs:element minOccurs="0" ref="on_boot"/>
        <!--xs:element ref="display_console" minOccurs="0" /-->
        <!--xs:element ref="xterm" minOccurs="0" /-->
        <xs:element maxOccurs="unbounded" minOccurs="0" ref="if"/>
        <xs:element maxOccurs="unbounded" minOccurs="0" ref="route"/>
        <xs:element minOccurs="0" ref="forwarding"/>
        <xs:element maxOccurs="unbounded" minOccurs="0" ref="user"/>
        <xs:element maxOccurs="unbounded" minOccurs="0" ref="filetree"/>
        <xs:element maxOccurs="unbounded" minOccurs="0" ref="exec"/>
      </xs:sequence>
      <xs:attribute name="name" type="xs:string" use="required"/>
      <xs:attribute name="type" type="xs:string" use="required"/>
      <xs:attribute name="subtype" type="xs:string" use="optional"/>
      <xs:attribute name="os" type="xs:string" use="optional"/>
      <xs:attribute name="order" type="xs:string" use="optional"/>
      <xs:attribute name="exec_mode" type="xs:string" use="optional"/>
     </xs:complexType>
  </xs:element>
The problem with this code is that it forces the write in a determinate order for each of the branches. I would like to continue keeping the number of appearances but that it could appear in any order.
For example, if you see first, "filesystem" and then "route" then it will be correct, while if they appear in reverse order it will be incorrect, and that's what I want to change.


Another thing I need some help is about restrictions of values that depends on others.
Using "restriction" I could limit the values of some tags to list, but I would need that it will depend on this list of other parameters.
Here an example:

Code:
  <vm name="h4" type="libvirt" subtype="kvm" os="linux">
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem>
    <mem>128M</mem>
    <if id="1" net="Net2">
      <ipv4>10.0.2.3/24</ipv4>
    </if>
    <route type="ipv4" gw="10.0.2.1">default</route>    
    <!-- Copy the files under conf/tutorial_ubuntu/h4 to vm /var/www directory -->
    <filetree seq="start-www" root="/var/www">conf/tutorial_ubuntu/h4</filetree>
    <!-- Start/stop apache www server -->
    <exec seq="start-www" type="verbatim" ostype="system">chmod 644 /var/www/*</exec>
    <exec seq="start-www" type="verbatim" ostype="system">service apache2 start</exec>
    <exec seq="stop-www" type="verbatim"  ostype="system">service apache2 stop</exec>    
  </vm>
In the above code we see that appears type = "libvirt". Well, for example, when "type" display that value, I'd like that in "so" could only appear "linux" or "olive".

How can I do that?

Thanks.