JMRI: XML Usage
JMRI uses XML for a number of purposes: to hold decoder definitions, for its persistance system for configuration and panel information, and to create parts of the web site from other files. This page describes some aspects of this.
File Format Definitions
Starting with JMRI 2.9.4 file formats are specified by XML Schema. Those XML Schema are described on a separate page.
Prior to that, DTDs were used. Reading those older files is still supported.
Those schema and DTDs need to be available to the program when it reads the files, as they define the default values of missing attributes and other needed information.
JMRI writes all files to reference schema using URLs such as "http://jmri.org/xml/schema/layout.xsd". When read by the program this will automatically be handled properly by a custom resolver. When read by e.g. a web browser, the browser can get the schema from the main JMRI web servers when needed.
The DTDs were located from DOCTYPE definition statements in the XML files. For historical reasons, these can be in several formats. The complicated set of rules for mapping those to a directory location is described on a separate page.
JMRI XML files can generally be formatted and viewed in web browsers. We control the formatting using XSLT transforms. The process is described on a separate page.
XML files can be edited with a text editor, but a dedicated editor can help a lot. We provide a list of editors, along with a few comments on each.