XML-Events

Description of the data-format to write (and read) Matsim-Events

Events should be stored in XML-Files.

There is no DTD for Events because each event could use other attributes as needed. As long as it is not possible to defined something like "free additional attributes" for tags in DTD, there will be no DTD for events.xml. Therefore, the events-fileformat ist very simple to reduce the possibility of errors.

The file contains:

  • xml-Header
  • root-tag <events>
  • <event>-tags with only attributes, otherwise empty (<event> is a leaf in the xml/dom-tree)

event-attributes:

The following attributes are required:

  • time, in seconds past midnight
  • type, an identifying string, see also Events

Most events will also have the following attributes:

  • agent, the ID of an agent
  • link, the ID of a link in the network

Additional event-types may define additional attributes.

Example of an events.xml-file:

<?xml version="1.0" encoding="utf-8"?>
<events xml:lang="de-CH">
<event time="21600" type="departure" agent="759062" link="47" /> <!-- time: 06:00, in seconds -->
<event time="22980" type="arrival" agent="759062" link="122" /> <!-- time: 06:23 -->
<event time="21720" type="departure" agent="966916" link="25" />
<event time="22865" type="arrival" agent="966916" link="312" />
</events>

Additional event-attributes:

  • "activity", the number of the activity starting with0
  • "act_type", the type of the activity, e.g. "home", "work"
  • "leg", the leg number starting with 0