Skip to content
Lars Kamber edited this page Mar 5, 2020 · 8 revisions

XML Basics

Editing

We recommend the following approaches:

  • Windows — indicates convenient text editors, and archive tools
  • For MacOSX — handles archives fine but not necessarily XML files; dashcode (presumably part of xcode) can edit XML files but struggles with scripts. There are a number of other MacOSX editors search for one
  • Linux — Kate, vim, emacs, gedit, eclipse (or many more)

Syntax

Scenarios are written in XML. There is a (long and confusing) standard describing XML here, and a (much more accessible) tutorial here. The basic information is:

  1. The following things enclosed by angle brackets are called elements. Each one must be closed, either with the short form <.../> or the long form <x>...</x>.
<a/>  
<aLongElementName/>  
<b></b>  
<c>  
  <d>  
    <e/>  
  </d>  
</c>
  1. Elements may have attributes. Each attribute has a name (before the = sign) and a value (within the double quotes).
<x a="1" b="2" c="3"/>
<y anAttribute="a value">
  <z anotherAttribute="..."/>
</y>
  1. You can add comments or "comment out" code with the following notation:
<!-- This is a comment. -->
<!-- Element 'a' is used by the program, 'b' is not. -->
<a/>
<!-- <b/> -->
  1. All scenarios start and end with code like one of the following chunks (pick the appropriate version). Versions 31 and earlier require analysisNo and wuID attributes (in version 32 these are used only for fitting runs and BOINC). Versions 23 and earlier also require an assimMode attribute. The name attribute can be set to whatever you want.
<!-- versions 32 or later (replace the number 32 below) -->
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<om:scenario xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    name="example" schemaVersion="32"
    xsi:schemaLocation="http://openmalaria.org/schema/scenario_32 scenario_32.xsd"
    xmlns:om="http://openmalaria.org/schema/scenario_32">
  ...
</om:scenario>

<!-- versions 24 to 31 (replace the number 31 below) -->
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<scenario xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" analysisNo="0"
    name="template scenario" schemaVersion="31" wuID="0"
    xsi:noNamespaceSchemaLocation="scenario_31.xsd">
  ...
</scenario>

The file name (scenario_xx.xsd) can be changed to the name of the schema file, if this is different, but the URL (http://.../scenario_32) and the schemaVersion="32" attribute shouldn't be changed, except to replace the number with the appropriate version.

Clone this wiki locally