Trip Configuration File

back to index

The data about each trip is stored in a single trip configuration file. All these files are located in a single directory that is specified by the global configuration file. Any XML file that appears in that directory is processed as if it was a trip file. Also, changes made to trip files are reloaded automatically, so there is no need to stop the application at any point in order to perform changes.

The next listing illustrates an example outlined configuration file.

trip_config.xml
 
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE trip PUBLIC "http://www.ahristov.com/uri/jpblog-trip/1.0" "trip.dtd" >
<trip 
  default-language="es"
  map="/trips/maps/europa.gif"  
  photo="DSC04145.JPG"
  order="43"
  license="http://creativecommons.org/licenses/by-nd/2.5/">
  
  <title lang="es">2006 - Sur de Europa</title>
  <title lang="en">2006 - Southern Europe</title>
  
  <url-alias>2006-Sur de Europa</url-alias>    
  <url-alias lang="en">2006-Southern Europe</url-alias>      

  <trip-leg 
    x="196" 
    y="205" 
    path="/trips/2006/martigues"
    photo="DSC03736.JPG" 
    longitude='5.05484' 
    latitude='43.40738'
    michelin-data="-tyc9poxugg7d0o"
    from="2006-07-22" to="2006-07-22"   >
    
    <title>Martigues</title>
    <title lang="en">Martigues</title>    
    <include-url lang="es" src="/trips/2006/martigues/comment_es.jsp" />
    
    <photo src="DSC03736.JPG" >
      <descr>Puerto de Martigues</descr>
      <descr lang="en">Port of Martigues</descr>
    </photo>
    
    <clip src="MOV04421.MPG">
      <descr lang="es">Monje pintando un nuevo icono</descr>
      <descr lang="en">A monk painting a new icon</descr>
    </clip>
    
  </trip-leg>  
  
  ...
</trip>  

 

The first element of the file is the trip element, which contains the following attributes:

Inside the trip element, we can have a set ot titles and url-aliases. The url-alias element specifies the URL used to access the locations of the trip (see the section about URL handling for more information), whereas the title element simply specifies a descriptive title of the trip. If the url-alias is missing, it is assumed that it is equal to the title.

The lang attribute indicates for which language the description or url applies. If the attribute is missing, the default language is assumed.  The lang attribute may also be set to the special literal "any", which means that the description or url is valid for any language.

Trip legs (locations)

Each trip is composed of a series of trip-leg elements. There must be at least one such element per trip. A trip-leg describes a specific location that you visited. It has the following attributes:

Just as the trip itself, each trip leg has a set of titles and url-aliases, obeying the same rules and conventions as those present in the trip, but applying only to this specific trip leg. In the above example, the only trip-leg of the trip has a title (in english) of "Martigues", and a title (in the default language) of "Martigues". Since no url-alias elements are present, the url aliases are assumed to be equal to the titles.

Media Items

Each trip leg can have as many "media items" as necessary, which are displayed in the same order in which they are present in the file. Currently, two media items are defined : photo - representing a photograph and clip - representing a video clip.

All media items have a required attribute called src that specifies the name of the file containing the media item. That file must be located in the directory pointed to by the path attribute of the corresponding trip leg.

Also, a media item can have (but it is not required to) a set of descriptions using the descr element.

Included and displayed pages

When the user chooses to view the contents of a location or trip leg, three possible things can happen: