<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.gophernet.org/schemata/transit.xsd"
  elementFormDefault="qualified"
  xmlns="http://www.gophernet.org/schemata/transit.xsd"
  xmlns:trans="http://www.gophernet.org/schemata/transit.xsd"
  xmlns:addr="http://www.gophernet.org/schemata/address.xsd"
  xml:lang="en">

  <xsd:annotation>
    <xsd:documentation>
      The purpose of a transit document is threefold: to mark and describe the
      points of interest for a transit system, to describe the paths
      connecting the routes, and to describe for a trip along a path the times
      at which each point is reached.
    </xsd:documentation>
  </xsd:annotation>

  <xsd:import namespace="http://www.gophernet.org/schemata/address.xsd"
    schemaLocation="http://www.gophernet.org/schemata/address.xsd"/>

  <!-- the document element and basic top-level structure -->
  <xsd:element name="transit">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="transitPoints" minOccurs="0" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation>
              Point definitions are split into groups based on the type of
              structure: train stations, which are large structures providing
              train service that may or may not have parking; Park &amp; Ride
              lots, which are a lot (no address) providing bus service and
              parking, and bus stops, a point providing bus service and no
              parking.

              In Cobb county, CCT has another type of point, the bus transfer
              center.  These act as a hub for multiple bus routes, similar to
              the bus bays that MARTA uses at their train stations.  However,
              of the two transfer centers (Marietta and Cumberland), one has a
              parking lot, making it, in effect, a Park &amp; Ride, and I
              think it's fair to simply call the other a stop.
            </xsd:documentation>
          </xsd:annotation>

          <xsd:complexType>
            <xsd:sequence>

              <xsd:element name="stations" minOccurs="0" maxOccurs="1">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element ref="station" minOccurs="1" maxOccurs="unbounded"/>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>

              <xsd:element name="parkandridelots" minOccurs="0" maxOccurs="1">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element ref="parkandride" minOccurs="1" maxOccurs="unbounded"/>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>

              <xsd:element name="busstops" minOccurs="0" maxOccurs="1">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element ref="stop" minOccurs="1" maxOccurs="unbounded"/>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>

            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>

        <xsd:element name="transitRoutes" minOccurs="0" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation>
              There are two basic types of route: bus and train.  A train can
              only stop at a station.  While it's true that a bus only stops
              at bus stops, and in a perfect world all of the bus stops would
              be known, transit systems (I'm looking at you, MARTA) only
              provide the points used for route scheduling, leaving the
              application writer forced to assume that a bus can stop at any
              point on its route.  There are some routes where the bus does
              have an extended period where it will not stop, such as
              shuttles, express routes and routes using a highway, but those
              variations are handled in the route definitions.
            </xsd:documentation>
          </xsd:annotation>

          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="raillines" minOccurs="0" maxOccurs="1">
                <xsd:complexType>
                  <xsd:choice minOccurs="1" maxOccurs="unbounded">
                    <xsd:element name="path" type="railpath"> 
                      <xsd:annotation>
                        <xsd:documentation>
                          A path is a named portion of a line that can be
                          used in multiple line definitions.  This is helpful
                          for when two lines overlap.

                          To use MARTA as an example, the Proctor Creek trains
                          run between Banhead station and (depending on the
                          time) a station as far east as Candler Park.  However,
                          only Bankhead station is not on the east-west line.
                          A named path between Ashby and Candler Park could be
                          used for both the east-west line and the Proctor
                          Creek line.

                          As another example, the split between the North and
                          Northeast lines happens about a mile north of
                          Lindbergh.  This shared track segment could be defined
                          and shared using a path element.
                        </xsd:documentation>
                      </xsd:annotation>
                    </xsd:element>

                    <xsd:element ref="line"/>
                  </xsd:choice>
                </xsd:complexType>

                <xsd:key name="railpathkey">
                  <xsd:selector xpath="trans:path"/>
                  <xsd:field xpath="@id"/>
                </xsd:key>

                <xsd:keyref name="railpathref" refer="railpathkey">
                  <xsd:selector xpath="trans:line/trans:pathref"/>
                  <xsd:field xpath="@pathid"/>
                </xsd:keyref>
              </xsd:element>

              <xsd:element name="busroutes" minOccurs="0" maxOccurs="1">
                <xsd:complexType>
                  <xsd:choice minOccurs="1" maxOccurs="unbounded">
                    <xsd:element name="path" type="buspath">
                      <xsd:annotation>
                        <xsd:documentation>
                          The purpose for this element is similar to that of
                          the rail's path element, but intended more for
                          variations in a bus's route.  Bus systems often
                          define more than one path for a particular route in
                          order to reuse the main route's path when adding
                          selective trips and variations, and this element
                          provides a similar mechanism.
                        </xsd:documentation>
                      </xsd:annotation>
                    </xsd:element>

                    <xsd:element ref="route"/>
                    <xsd:element ref="routegroup"/>
                  </xsd:choice>
                </xsd:complexType>

                <xsd:key name="buspathkey">
                  <xsd:selector xpath="trans:path"/>
                  <xsd:field xpath="@id"/>
                </xsd:key>

                <xsd:keyref name="buspathref" refer="buspathkey">
                  <xsd:selector xpath="trans:route/trans:pathref"/>
                  <xsd:field xpath="@pathid"/>
                </xsd:keyref>

                <xsd:key name="routegroupkey">
                  <xsd:selector xpath="trans:routegroup"/>
                  <xsd:field xpath="@id"/>
                </xsd:key>


                <xsd:unique name="routegrouprouteunq">
                  <xsd:annotation>
                    <xsd:documentation>
                      A route can only appear in one routegroup.
                    </xsd:documentation>
                  </xsd:annotation>
                  <xsd:selector xpath="trans:routegroup/trans:route"/>
                  <xsd:field xpath="@routeid"/>
                </xsd:unique>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>

        <xsd:element name="transitSchedules" minOccurs="0" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation>
              Like with the route definitions, the schedules are split by
              route type.
            </xsd:documentation>
          </xsd:annotation>

          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="railschedules" minOccurs="0" maxOccurs="1">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element ref="railschedule" minOccurs="1" maxOccurs="unbounded"/>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>

              <xsd:element name="busschedules" minOccurs="0" maxOccurs="1">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element ref="busschedule" minOccurs="1" maxOccurs="unbounded"/>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>

        <xsd:element name="calendar" minOccurs="0" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation>
              This element defines the days used elsewhere in the document.
            </xsd:documentation>
          </xsd:annotation>

          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="holidays" minOccurs="0" maxOccurs="1">
                <xsd:annotation>
                  <xsd:documentation>
                    The holidays is a list of days considered a holiday by the
                    transit system.
                  </xsd:documentation>
                </xsd:annotation>
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="holiday" minOccurs="1" maxOccurs="unbounded">
                      <xsd:complexType>
                        <xsd:attribute name="date" type="xsd:date" use="required"/>
                      </xsd:complexType>
                    </xsd:element>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>

    <!-- the points use keys in addition to ID and NMTOKEN types to restrict
         the scope of the reference while retaining the ID concept (and
         search capabilities) of pre-schema XML.  Not using IDREF so that
         reference points can be used in a document without the original
         point definitions. -->
    <xsd:key name="stationkey">
      <xsd:selector xpath="trans:transitPoints/trans:stations/trans:station"/>
      <xsd:field xpath="@id"/>
    </xsd:key>

    <xsd:keyref name="stationref" refer="stationkey">
      <xsd:selector xpath=".//trans:stationpoint"/>
      <xsd:field xpath="@stationid"/>
    </xsd:keyref>

    <xsd:keyref name="railschedulestationref" refer="stationkey">
      <xsd:selector xpath="trans:transitSchedules/trans:railschedules/trans:railschedule/trans:stationtime"/>
      <xsd:field xpath="@stationid"/>
    </xsd:keyref>

    <xsd:keyref name="busschedulestationref" refer="stationkey">
      <xsd:selector xpath="trans:transitSchedules/trans:busschedules/trans:busschedule/trans:trip/trans:stationtime"/>
      <xsd:field xpath="./@stationid"/>
    </xsd:keyref>

    <xsd:key name="parkandridekey">
      <xsd:selector xpath="trans:transitPoints/trans:parkandridelots/trans:parkandride"/>
      <xsd:field xpath="@id"/>
    </xsd:key>

    <xsd:keyref name="parkandrideref" refer="parkandridekey">
      <xsd:selector xpath=".//trans:parkandridepoint"/>
      <xsd:field xpath="@parkandrideid"/>
    </xsd:keyref>

    <xsd:keyref name="busscheduleparkandrideref" refer="parkandridekey">
      <xsd:selector xpath="trans:transitSchedules/trans:busschedules/trans:busschedule/trans:trip/trans:parkandridetime"/>
      <xsd:field xpath="@parkandrideid"/>
    </xsd:keyref>

    <xsd:key name="busstopkey">
      <xsd:selector xpath="trans:transitPoints/trans:busstops/trans:stop"/>
      <xsd:field xpath="@id"/>
    </xsd:key>

    <xsd:keyref name="busstopref" refer="busstopkey">
      <xsd:selector xpath=".//trans:stoppoint"/>
      <xsd:field xpath="@stopid"/>
    </xsd:keyref>

    <xsd:keyref name="busschedulesstopref" refer="busstopkey">
      <xsd:selector xpath="trans:transitSchedules/trans:busschedules/trans:busschedule/trans:trip/trans:stoptime"/>
      <xsd:field xpath="@stopid"/>
    </xsd:keyref>

    <xsd:key name="linekey">
      <xsd:selector xpath="trans:transitRoutes/trans:raillines/trans:line"/>
      <xsd:field xpath="@id"/>
    </xsd:key>
    
    <xsd:keyref name="railschedulelineref" refer="linekey">
      <xsd:selector xpath="trans:transitSchedules/trans:railschedules/trans:railschedule"/>
      <xsd:field xpath="@lineid"/>
    </xsd:keyref>

    <xsd:key name="routekey">
      <xsd:selector xpath="trans:transitRoutes/trans:busroutes/trans:route"/>
      <xsd:field xpath="@id"/>
    </xsd:key>

    <xsd:keyref name="busschedulerouteref" refer="routekey">
      <xsd:selector xpath="trans:transitSchedules/trans:busschedules/trans:buschedule"/>
      <xsd:field xpath="@routeid"/>
    </xsd:keyref>

    <xsd:keyref name="routegroupref" refer="routekey">
      <xsd:selector xpath="trans:transitRoutes/trans:busroutes/trans:routegroup/trans:route"/>
      <xsd:field xpath="@routeid"/>
    </xsd:keyref>
  </xsd:element>

  <xsd:element name="station">
    <xsd:annotation>
      <xsd:documentation>
        The station element describes a train station.  It includes
        the stations address, county, type (for parking information) and an
        optional link to the transit system's web page for the station.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:complexType>
      <xsd:all>
        <xsd:element ref="point" minOccurs="1" maxOccurs="1"/>

        <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>

        <xsd:element ref="addr:address" minOccurs="1" maxOccurs="1"/>

        <xsd:element name="county" type="xsd:string" minOccurs="1" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation>
              The county is separate from the address since, though it is not
              used for mailing information, it is useful for understanding
              the taxing district in which the station exists.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>

        <xsd:element name="link" type="xsd:anyURI" minOccurs="0" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation>
              A link to the transit system's web page for the station.  This
              element is optional in case the system does not provide a
              particular site.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>

        <xsd:element name="type" minOccurs="1" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation>
              This element is meant to describe the type of parking available
              at the station.  This information might be displayed on a map by
              using a different icon for the different types.
            </xsd:documentation>
          </xsd:annotation>

          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="normal">
                <xsd:annotation>
                  <xsd:documentation>
                    No parking is available.
                  </xsd:documentation>
                </xsd:annotation>
              </xsd:enumeration>

              <xsd:enumeration value="shortterm">
                <xsd:annotation>
                  <xsd:documentation>
                    24-hour parking is available, but no overnight parking.
                  </xsd:documentation>
                </xsd:annotation>
              </xsd:enumeration>

              <xsd:enumeration value="longterm">
                <xsd:annotation>
                  <xsd:documentation>
                    Parking is available for periods longer than 24 hours.
                  </xsd:documentation>
                </xsd:annotation>
              </xsd:enumeration>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
      </xsd:all>

      <xsd:attribute name="id" type="xsd:ID" use="required"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="parkandride">
    <xsd:annotation>
      <xsd:documentation>
        Park and ride lots differ from train stations in terms of data provided
        in that park and ride lots do not normall have an address.  For this
        reason, the address element is replaced by a freeform location element.
        Everything else is pretty much the same.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:complexType>
      <xsd:all>
        <xsd:element ref="point" minOccurs="1" maxOccurs="1"/>
        <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
        <xsd:element name="location" type="xsd:string" minOccurs="1" maxOccurs="1"/>
        <xsd:element name="county" type="xsd:string" minOccurs="1" maxOccurs="1"/>
        <xsd:element name="link" type="xsd:anyURI" minOccurs="0" maxOccurs="1"/>
      </xsd:all>

      <xsd:attribute name="id" type="xsd:ID" use="required"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="stop">
    <xsd:annotation>
      <xsd:documentation>
        Bus stops, since they're normally just a point in the road somewhere,
        provide very little information.  The name should also serve as a
        description of the location.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:complexType>
      <xsd:all>
        <xsd:element ref="point" minOccurs="1" maxOccurs="1"/>
        <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
      </xsd:all>
      <xsd:attribute name="id" type="xsd:ID" use="required"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:group name="railelements">
    <xsd:choice>
      <xsd:element ref="point"/>
      <xsd:element ref="stationpoint"/>
    </xsd:choice>
  </xsd:group>

  <xsd:group name="buselements">
    <xsd:choice>
      <xsd:group ref="railelements"/>
      <xsd:element ref="parkandridepoint"/>
      <xsd:element ref="stoppoint"/>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="railpath">
    <xsd:annotation>
      <xsd:documentation>
        This type is used by the path element in raillines.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:group ref="railelements" minOccurs="1" maxOccurs="unbounded"/>
    <xsd:attribute name="id" type="xsd:ID" use="required"/>
  </xsd:complexType>

  <xsd:element name="line">
    <xsd:annotation>
      <xsd:documentation>
        A line connects rail stations together into an ordered unit as well
        as providing information for the actual placement of the tracks when
        available.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:complexType>
      <xsd:choice minOccurs="1" maxOccurs="unbounded">
        <xsd:group ref="railelements"/>
        <xsd:element ref="pathref"/>
      </xsd:choice>
      <xsd:attribute name="id" type="xsd:ID" use="required"/>
      <xsd:attribute name="name" type="xsd:string" use="required"/>
      <xsd:attribute name="link" type="xsd:anyURI" use="optional"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:complexType name="buspath">
    <xsd:annotation>
      <xsd:documentation>
        This type is used by the path element in busroutes.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:group ref="buselements" minOccurs="1" maxOccurs="unbounded"/>
    <xsd:attribute name="id" type="xsd:ID" use="required"/>
  </xsd:complexType>


  <xsd:element name="route">
    <xsd:annotation>
      <xsd:documentation>
        A route is a single line take by a bus.  Routes with multiple paths
        should be defined as multiple route elements, using path elements to
        share common pieces.  Bus routes, unlike rail lines, are treated as
        unidirectional, so the two directions of a bus route should be
        specified separately.  Routes can be grouped into a single group using
        the routegroup element.
      </xsd:documentation>
    </xsd:annotation>
    
    <xsd:complexType>
      <xsd:choice minOccurs="1" maxOccurs="unbounded">
        <xsd:group ref="buselements"/>
        <xsd:element ref="pathref"/>
      </xsd:choice>
      <xsd:attribute name="id" type="xsd:ID" use="required"/>
      <xsd:attribute name="name" type="xsd:string" use="required"/>
      <xsd:attribute name="link" type="xsd:anyURI" use="optional"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="routegroup">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="route" minOccurs="1" maxOccurs="unbounded">
          <xsd:complexType>
            <xsd:attribute name="routeid" type="xsd:IDREF" use="required"/>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
      <xsd:attribute name="id" type="xsd:ID" use="required"/>
      <xsd:attribute name="name" type="xsd:string" use="required"/>
      <xsd:attribute name="link" type="xsd:anyURI" use="optional"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:attribute name="time" type="xsd:time"/>

  <xsd:element name="railschedule">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="trip" type="railtrip" minOccurs="1" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="lineid" type="xsd:NMTOKEN" use="required"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:complexType name="railtrip">
    <xsd:annotation>
      <xsd:documentation>
        A railtrip describes the times at which a train passes through
        particular stations.  The trip does not need to include all stations on
        the line.  The endpoints of the trip will be treated as the points
        where the train begins and ends.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice minOccurs="1" maxOccurs="unbounded">
      <xsd:element name="stationtime">
        <xsd:complexType>
          <xsd:attribute name="stationid" type="xsd:NMTOKEN" use="required"/>
          <xsd:attribute ref="time" use="required"/>
        </xsd:complexType>
      </xsd:element>
    </xsd:choice>

    <xsd:attribute name="type" use="required" type="scheduletypes"/>
  </xsd:complexType>

  <xsd:element name="busschedule">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="trip" type="bustrip" minOccurs="1" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="routeid" type="xsd:NMTOKEN" use="required"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:complexType name="bustrip">
    <xsd:annotation>
      <xsd:documentation>
        A bustrip, like a railtrip, describes the times at which a bus crosses
        a particular point.  The difference is that a bus trip can contain
        more types of point.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice minOccurs="1" maxOccurs="unbounded">
      <xsd:element name="stationtime">
        <xsd:complexType>
          <xsd:attribute name="stationid" type="xsd:NMTOKEN" use="required"/>
          <xsd:attribute ref="time" use="required"/>
        </xsd:complexType>
      </xsd:element>

      <xsd:element name="parkandridetime">
        <xsd:complexType>
          <xsd:attribute name="parkandrideid" type="xsd:NMTOKEN" use="required"/>
          <xsd:attribute ref="time" use="required"/>
        </xsd:complexType>
      </xsd:element>

      <xsd:element name="stoptime">
        <xsd:complexType>
          <xsd:attribute name="stopid" type="xsd:NMTOKEN" use="required"/>
          <xsd:attribute ref="time" use="required"/>
        </xsd:complexType>
      </xsd:element>
    </xsd:choice>

    <xsd:attribute name="type" use="required" type="scheduletypes"/>
  </xsd:complexType>

  <!-- point type definitions -->
  <xsd:complexType name="latlngpoint">
    <xsd:annotation>
      <xsd:documentation>
        A latitude/longitude coordinate pair describes a point on the surface
        of the earth, a sphere for the purposes of the coordinate system.  The
        latitude component describes the angle between the equator and a line
        parallel to the equator that intersects the point.  The longitude
        component describes the angle between the prime meridian and an arc
        through the poles that intersects the points.  As such, latitude
        numbers must be in the range [-90,90], and longitude numbers must be
        in the range (-180,180].  The latitude range in inclusive since 90 and
        -90 describe the north and south poles, respectively, whereas in
        longitude -180 and 180 are equivalent.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:attribute name="lat" use="required">
      <xsd:simpleType>
        <xsd:restriction base="xsd:decimal">
          <xsd:minInclusive value="-90"/>
          <xsd:maxInclusive value="90"/>
        </xsd:restriction>
      </xsd:simpleType>
    </xsd:attribute>
    <xsd:attribute name="lng" use="required">
      <xsd:simpleType>
        <xsd:restriction base="xsd:decimal">
          <xsd:minExclusive value="-180"/>
          <xsd:maxInclusive value="180"/>
        </xsd:restriction>
      </xsd:simpleType>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="point" type="latlngpoint"/>

  <xsd:element name="stationpoint">
    <xsd:complexType>
      <xsd:attribute name="stationid" type="xsd:NMTOKEN" use="required"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="parkandridepoint">
    <xsd:complexType>
      <xsd:attribute name="parkandrideid" type="xsd:NMTOKEN" use="required"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="stoppoint">
    <xsd:complexType>
      <xsd:attribute name="stopid" type="xsd:NMTOKEN" use="required"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="pathref">
    <xsd:annotation>
      <xsd:documentation>
        Pathref elements are different from other point elements in that they
        represent a set of points instead of a single point.  The pathid
        refers to the id of a path element within the same context (bus or
        rail).
      </xsd:documentation>
    </xsd:annotation>

    <xsd:complexType>
      <xsd:attribute name="pathid" type="xsd:IDREF" use="required"/>
      <xsd:attribute name="reverse" use="optional">
        <xsd:annotation>
          <xsd:documentation>
            If this attribute is present, the points in the referenced path are
            reversed before being added to the current line.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:simpleType>
          <xsd:restriction base="xsd:string">
            <xsd:enumeration value="1"/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:attribute>
    </xsd:complexType>
  </xsd:element>

  <xsd:simpleType name="scheduletypes">
    <xsd:annotation>
      <xsd:documentation>
        This enumeration describes the different types of schedule that may be
        available.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="weekday">
        <xsd:annotation>
          <xsd:documentation>
            M-F schedule
          </xsd:documentation>
        </xsd:annotation>
      </xsd:enumeration>

      <xsd:enumeration value="saturday"/>
      <xsd:enumeration value="sunday"/>
      <xsd:enumeration value="holiday"/>
    </xsd:restriction>
  </xsd:simpleType>
</xsd:schema>
