<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="schema2xhtml.xsl" type="text/xsl"?>

<!-- XML Schema for JMRI aspect-signaling support                           -->

<!-- $Id: aspecttable.xsd 17977 2011-07-18 17:23:46Z zoo $ -->

<!-- This schema is part of JMRI. Copyright 2009.                           -->
<!--                                                                        -->
<!-- JMRI is free software; you can redistribute it and/or modify it under  -->
<!-- the terms of version 2 of the GNU General Public License as published  -->
<!-- by the Free Software Foundation. See the "COPYING" file for a copy     -->
<!-- of this license.                                                       -->
<!--                                                                        -->
<!-- JMRI is distributed in the hope that it will be useful, but WITHOUT    -->
<!-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or  -->
<!-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License  -->
<!-- for more details.                                                      -->

<xs:schema xmlns:xs  ="http://www.w3.org/2001/XMLSchema"
           xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:docbook="http://docbook.org/ns/docbook"
           xmlns:jmri="http://jmri.org/xml/schema/JMRIschema"
           xsi:schemaLocation="
                http://jmri.org/xml/schema/JMRIschema http://jmri.org/xml/schema/JMRIschema.xsd
                http://docbook.org/ns/docbook http://jmri.org/xml/schema/docbook/DocBook.xsd
            "
           >

<xs:import namespace='http://docbook.org/ns/docbook' schemaLocation='http://jmri.org/xml/schema/docbook/DocBook.xsd'/>

<xs:element name="aspecttable">

    <xs:annotation>
        <xs:documentation>
          Top level elements without child elements become properties of the Signal System name bean.  
          We therefore allow unlimited extension of those at the end of the aspecttable element.
          Only the first of multiple occurrances is kept as a property.
        </xs:documentation>
        <xs:appinfo>
            <jmri:usingclass configurexml="false">jmri.managers.DefaultSignalSystemManager</jmri:usingclass>
        </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>

        <xs:element name="name" minOccurs="1" maxOccurs="1"></xs:element>

        <xs:element name="date" minOccurs="0" maxOccurs="1"></xs:element>
        <xs:element name="reference" minOccurs="0" maxOccurs="unbounded"></xs:element>
     
        <xs:element ref="docbook:copyright" minOccurs="1" maxOccurs="1" >
          <xs:annotation><xs:documentation>
          DocBook element(s) providing copyright information in standard form.
          Must be present.
          </xs:documentation></xs:annotation>
        </xs:element>
        
        <xs:element ref="docbook:authorgroup" minOccurs="1" maxOccurs="unbounded" >
          <xs:annotation><xs:documentation>
          DocBook element(s) describing the authors in standard form
          </xs:documentation></xs:annotation>
        </xs:element>
        
        <xs:element ref="docbook:revhistory" minOccurs="1" maxOccurs="unbounded" >
          <xs:annotation><xs:documentation>
          DocBook element(s) describing the revision history in standard form
          </xs:documentation></xs:annotation>
        </xs:element>

        <xs:element name="aspects" minOccurs="1" maxOccurs="1">
        <xs:annotation><xs:documentation>
        ******** Required Aspect Table  **********
        </xs:documentation></xs:annotation>
          <xs:complexType>
            <xs:sequence>
              
              <xs:element name="aspect" minOccurs="1" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:annotation><xs:documentation>
                  Top level elements without child elements become properties of the aspect.  
                  We therefore allow unlimited extension of those at the end of the aspect element.
                  Only the first of multiple occurrances is kept as a property.
                  </xs:documentation></xs:annotation>
                  
                  <xs:sequence>
                    
                    <xs:element name="name" minOccurs="1" maxOccurs="1">
                      <xs:annotation><xs:documentation>
                      This must match zero or one "aspectname" element 
                      in each appearance definition file.
                      </xs:documentation></xs:annotation>
                    </xs:element>
                    
                    <xs:element name="title" minOccurs="0" maxOccurs="1"></xs:element>
                    <xs:element name="rule" minOccurs="0" maxOccurs="1"></xs:element>
                    <xs:element name="indication" minOccurs="0" maxOccurs="1"></xs:element>
                    <xs:element name="description" minOccurs="0" maxOccurs="unbounded"></xs:element>
                    <xs:element name="reference" minOccurs="0" maxOccurs="unbounded"></xs:element>
                    <xs:element name="comment" minOccurs="0" maxOccurs="unbounded"></xs:element>
                    <xs:element name="imagelink" minOccurs="0" maxOccurs="unbounded"></xs:element>
                    <xs:element name="speed" minOccurs="0" maxOccurs="unbounded"></xs:element>
                    <xs:element name="speed2" minOccurs="0" maxOccurs="unbounded"></xs:element>
                    <xs:element name="route" minOccurs="0" maxOccurs="1">
                     <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:enumeration value="Diverging"/>
                          <xs:enumeration value="Normal"/>
                          <xs:enumeration value="Either"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    
                    <!-- next line causes a "Unique Particle Attribution" error -->
                    <!-- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/> -->

                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>

        <xs:element name="imagetypes" minOccurs="0" maxOccurs="1">
        <xs:annotation><xs:documentation>
        ******** Table of imagelink types **********
        </xs:documentation></xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="imagetype" minOccurs="0" maxOccurs="unbounded" >
                <xs:complexType>
                  <xs:attribute name="type" type="xs:string"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
                
        <xs:element name="appearancefiles" minOccurs="1" maxOccurs="1">
        <xs:annotation><xs:documentation>
        ******** Table of appearance XML filename **********
        </xs:documentation></xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="appearancefile" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:attribute name="href" type="xs:string"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>

      <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
      
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

