JMRI: Viewing XML Files
JMRI stores information about its operations and information that you create in XML files. For
example, when you use the PanelPro command File ⇒ Store, your tables and panels
are stored in an XML file. Other XML files hold preferences, control
information, operational information, decoder contents, your roster, and more.
Although XML is a structured text format, it is complicated and not particularly easy to read.
Most JMRI-created XML files can be displayed with more formatting (easier to read and print) in a
web browser using "XSLT stylesheets" (provided in the JMRI distribution). This sample panel XML file is an example of how
this formatting looks.
Viewing Methods
- To view an XML file that JMRI has created, just open the file with your favorite web
browser. In many cases, you should be able to just double-click the file name, or drag it to the web
browser's icon. On some platforms, you'll need to open it from the "File" menu.
Unfortunately, this approach doesn't always work because not all browsers properly
implement the use of XSLT. If the first browser you try doesn't display the XML file (usually just
showing a blank page), try a different browser. Early versions of Internet Explorer are particularly
problematic although the most recent versions work well. Mozilla, Safari, Opera, and Chrome also work,
while Firefox seems to work properly on some platforms and not on others. (There might also be options
that affect whether it works. Here's more technical background)
- Use the JMRI mini web server that is included in JMRI (version
2.9.4 and later). The file you want to view must also have been stored with JMRI 2.9.4 or later (if it
is older than that, load it into JMRI 2.9.4 or later and store it again). Then:
- Start JMRI (either DecoderPro or PanelPro). No layout connection is needed.
- Start the JMRI Web Server:
- PanelPro: Tools ⇒ Servers ⇒ Start JMRI Web Server
- DecoderPro: Actions ⇒ Start Web Server.
- Open any web browser on your computer and enter the URL "http://localhost:12080"
- You should now see the JMRI "home page" for your layout, like the example below.
If the XML file you wish to view is within the JMRI distribution directory, click on the
"/dist" link at bottom right. If it is within your preferences directory, click on the
"/prefs" link. Some of the key files in your /prefs directory are:
- Panel files ([named by you].xml), containing details of any panels and tables you created within
PanelPro
- Roster (roster.xml), listing information about your locomotives from DecoderPro
You can also click on any listed sub-directories to get to your files.
- You can then use your browser to view, print, save, etc. as desired.