<?xml version="1.0" encoding="UTF-8"?>

<!-- XML Schema for the Openbox window manager menu file -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://openbox.org/3.4/menu"
    xmlns:ob="http://openbox.org/3.4/menu"
    elementFormDefault="qualified">
    <!--
         root node
      -->
    <xs:element name="openbox_menu">
        <xs:complexType mixed="false">
            <xs:sequence maxOccurs="unbounded" minOccurs="1">
                <xs:element name="menu" type="ob:menu"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <!--
         complex types
      -->
    <xs:complexType name="menu">
        <xs:choice maxOccurs="unbounded" minOccurs="0">
            <xs:element maxOccurs="unbounded" minOccurs="0" name="menu" type="ob:menu"/>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="item" type="ob:item"/>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="separator" type="ob:empty"/>
        </xs:choice>
        <xs:attribute name="label" type="xs:string" use="optional"/>
        <xs:attribute name="execute" type="xs:string" use="optional"/>
        <xs:attribute name="id" type="xs:string" use="required"/>
    </xs:complexType>
    <xs:complexType name="empty">
        <xs:complexContent>
            <xs:restriction base="xs:anyType"/>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="item">
        <xs:sequence>
            <xs:element minOccurs="0" name="action">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="execute" type="xs:string"/>
                    </xs:sequence>
                    <xs:attribute name="name" type="ob:actionname" use="required"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="label" type="xs:string" use="required"/>
    </xs:complexType>
    <!--
         simple types / restrictions
      -->
    <xs:simpleType name="actionname">
        <xs:restriction base="xs:string">
            <xs:enumeration value="Execute"/>
            <xs:enumeration value="Restart"/>
            <xs:enumeration value="Reconfigure"/>
            <xs:enumeration value="Exit"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>
