Introduction to the TransXChange Schema (TransXChangeSchemaGuide-2.1-v-44)
What is the TransXChange Schema? The schema defines the properties of each element (e.g. Service, Operator) in the TransXChange model and how each element is related to others. The schema provides a common point of reference for all systems and users of TransXChange. The current schema version is 2.1. The schema is Crown Copyright. The latest version can be obtained from http://www.transxchange.org.uk/schema/schemas.htm 2
TransXChange File Formats TransXChange is based on an open source software standard known as ‘XML’. XML stands for eXtensible Mark-up Language. The elements for describing a bus service in a registration are arranged and presented in an XML document in accordance with the schema. Elements are defined by pairs of ‘tags’, which enclose each piece of textual or numerical information (see next slide). The schema is held separately in .xsd format. 3 3
From Schema to XML File
A Short Tour of the Schema The TransXChange Schema Guide is the authoritative guide to the schema. Although a very technical document, it also has a great deal of explanatory content and examples to assist those new to XML. The rest of the presentation gives a short introduction to the structure and the main elements of the schema. Further reference should be made to the TransXChange Schema Guide Chapter 6, and to the online examples in XML and PDF format.
Top Level TXC Schema Child elements Root element
The TXC Root Element The root element contains reference information for the file. Some attributes of the TransXChange root element include: xml:lang: Default language of document. Default is English. SchemaVersion: TransXChange schema version identifier used for the document content model. Fixed: must be the schema version, e.g. 2.0 . MappingSystem: Data system to use for mapping references ( OS , Navtech , etc) within the document. LocationSystem: Data system to use for location coordinate references within the document: WGS84 or Grid . Must be Grid for registration documents.
TransXChange Child Elements The TransXChange element has 12 child elements, which may be further subdivided into four groups: Registration Elements: Operator, Registration, (ShortNoticeRegistration). Service Supply elements: Service, (StandardService, FlexibleService, Line, JourneyPattern), JourneyPatternSection, VehicleJourney. Topographical elements: StopPoint, StopArea, NptgLocality, ServicedOrganisation. Route and Network topology elements: Route, RouteSection, RouteLink. Ancillary elements: SupportingDocument.
Registration Elements Operators: Describes the operator(s) of a service.
Operators XML Example
Registration Elements Registrations: A collection of Registration elements, each referencing a Service element.
Registrations XML Example
Service Supply elements Services: Definitions of services.
Services XML Example
Service Supply Elements JourneyPatternSections: Definitions of Journey Pattern Sections.
JourneyPatternSections Example
Service Supply elements VehicleJourneys: Definitions of Vehicle Journeys used in one or more services.
Service Supply elements
TransXChange Child Elements Topographical elements: NptgLocalities: Names of NPTG localities used in local stop definitions in the schedule. StopPoints: Local stop definitions for stops used in services in the schedule. StopAreas: Local StopArea definitions. Route and Network Topology elements: Routes: Definitions of transport routes. RouteSections: Definitions of the Route Sections making up all or part of a route.
TransXChange Child Elements Other child elements: ServicedOrganisations: Organisations serviced by the schedule, e.g. an LEA, and their working and non-working days. SupportingDocuments: Additional documents describing the service. Other important schema elements: The OperatingProfile element specifies on which days a service operates. It can be specified on a VehicleJourney, a JourneyPattern and on a Service.
Examples Work through some XML examples taken from the TransXChange website, starting with the Linear Route. Refer to Section 6 of the Schema Guide for further information on specific elements