-
-
Notifications
You must be signed in to change notification settings - Fork 266
XML File Format
This page details the XML file format (.nlogox/.nlogox3d) first introduced in NetLogo 7.0.0.
Note: all TEXT sections referenced in this page are conditionally modified to escape instances of reserved XML characters before saving. If a section includes <, >, or &, it will be wrapped in a CDATA tag, and any instances of the closing CDATA tag ]]> will be escaped. If it does not contain any of these characters, it will be stored as plain text.
The NetLogo XML file format is a standard XML document, using UTF-8 encoding and conforming to the XML 1.0 standard. The root element is model, which is defined as follows:
<model>
attributes
version :: String
snapToGrid :: Boolean
children
<code>
<widgets>
<info>
<turtleShapes>
<linkShapes>
<previewCommands>
<experiments>
<hubNetClient>
<systemDynamics>
<resources>
The model element can have any number of children, but if a section is specified more than once, only the last occurrence in the file will be used to load the model.
The code element contains the text from the Code Tab, and is defined as follows:
<code>
attributes
None
children
source :: TEXT
The widgets element contains the widgets on the Interface Tab, and is defined as follows:
<widgets>
attributes
None
children
<button>
<slider>
<view>
<view3d>
<monitor>
<switch>
<plot>
<chooser>
<output>
<input>
<note>
The widgets element must contain at least a view or view3d widget, but it can have any number of other widgets with any number of repetitions. The widget elements are defined as follows:
<button>
attributes
x :: Integer
y :: Integer
width :: Integer
height :: Integer
forever :: Boolean
kind :: "observer" | "turtle" | "patch" | "link"
disableUntilTicks :: Boolean
(optional) display :: String
(optional) actionKey :: Char
children
source :: TEXT
<slider>
attributes
x :: Integer
y :: Integer
width :: Integer
height :: Integer
min :: String
max :: String
default :: Double
step :: String
direction :: "horizontal" | "vertical"
(optional) display :: String
(optional) variable :: String
(optional) units :: String
(optional) sizeVersion :: Integer
children
None
<view>
attributes
x :: Integer
y :: Integer
width :: Integer
height :: Integer
minPxcor :: Integer
maxPxcor :: Integer
minPycor :: Integer
maxPycor :: Integer
patchSize :: Double
wrappingAllowedX :: Boolean
wrappingAllowedY :: Boolean
fontSize :: Integer
updateMode :: Integer
showTickCounter :: Boolean
frameRate :: Double
(optional) tickCounterLabel :: String
children
None
<view3d>
attributes
x :: Integer
y :: Integer
width :: Integer
height :: Integer
minPxcor :: Integer
maxPxcor :: Integer
minPycor :: Integer
maxPycor :: Integer
minPzcor :: Integer
maxPzcor :: Integer
patchSize :: Double
wrappingAllowedX :: Boolean
wrappingAllowedY :: Boolean
wrappingAllowedZ :: Boolean
fontSize :: Integer
updateMode :: Integer
showTickCounter :: Boolean
frameRate :: Double
(optional) tickCounterLabel :: String
children
None
<monitor>
attributes
x :: Integer
y :: Integer
width :: Integer
height :: Integer
precision :: Integer
fontSize :: Integer
(optional) display :: String
(optional) sizeVersion :: Integer
children
None
<switch>
attributes
x :: Integer
y :: Integer
width :: Integer
height :: Integer
on :: Boolean
(optional) display :: String
(optional) variable :: String
(optional) sizeVersion :: Integer
children
None
<plot>
attributes
x :: Integer
y :: Integer
width :: Integer
height :: Integer
xMin :: Double
xMax :: Double
yMin :: Double
yMax :: Double
autoPlotX :: Boolean
autoPlotY :: Boolean
legend :: Boolean
(optional) display :: String
(optional) xAxis :: String
(optional) yAxis :: String
(optional) sizeVersion :: Integer
children
<setupCode>
<updateCode>
<pen>
<setupCode>
attributes
None
children
source :: TEXT
<updateCode>
attributes
None
children
source :: TEXT
<pen>
attributes
display :: String
interval :: Double
mode :: Integer
color :: Integer
legend :: Boolean
children
<setupCode>
<updateCode>
<chooser>
attributes
x :: Integer
y :: Integer
width :: Integer
height :: Integer
current :: Integer
(optional) display :: String
(optional) variable :: String
(optional) sizeVersion :: Integer
children
<choice>
<choice>
attributes
type :: String
value :: Any
children
None
<choice> (if type == "list")
attributes
type :: "list"
children
value :: TEXT
<value>
attributes
value :: Any
children
None
<output>
attributes
x :: Integer
y :: Integer
width :: Integer
height :: Integer
fontSize :: Integer
children
None
<input>
attributes
x :: Integer
y :: Integer
width :: Integer
height :: Integer
multiline :: Boolean
type :: String
(optional) variable :: String
(optional) sizeVersion :: Integer
children
value :: TEXT
<note>
attributes
x :: Integer
y :: Integer
width :: Integer
height :: Integer
fontSize :: Integer
textColorLight :: Integer
textColorDark :: Integer
backgroundLight :: Integer
backgroundDark :: Integer
markdown :: Boolean
children
text :: TEXT
The info element contains the text from the Info Tab, and is defined as follows:
<info>
attributes
None
children
text :: TEXT
The turtleShapes element contains the shapes created in the Turtle Shapes Editor, and is defined as follows:
<turtleShapes>
attributes
None
children
<shape>
<shape>
attributes
name :: String
rotatable :: Boolean
editableColorIndex :: Integer
children
<circle>
<line>
<polygon>
<rectangle>
Each compound shape can contain any number of simpler shapes, which are defined as follows:
<circle>
attributes
color :: 32-bit packed RGBA
filled :: Boolean
marked :: Boolean
x :: Integer
y :: Integer
diameter :: Integer
children
None
<line>
attributes
color :: 32-bit packed RGBA
marked :: Boolean
startX :: Integer
startY :: Integer
endX :: Integer
endY :: Integer
children
None
<polygon>
attributes
color :: 32-bit packed RGBA
filled :: Boolean
marked :: Boolean
children
<point>
<point>
attributes
x :: Integer
y :: Integer
children
None
<rectangle>
attributes
color :: 32-bit packed RGBA
filled :: Boolean
marked :: Boolean
startX :: Integer
startY :: Integer
endX :: Integer
endY :: Integer
children
None
The linkShapes element contains the shapes created in the Link Shapes Editor, and is defined as follows:
<linkShapes>
attributes
None
children
<shape>
<shape>
attributes
name :: String
curviness :: Double
children
<line>
<indicator>
<line>
attributes
x :: Double
visible :: Boolean
children
<dash>
<dash>
attributes
value :: Float
children
None
<indicator>
attributes
None
children
<shape> ; this refers to a turtle shape, see section "Turtle Shapes"
The previewCommands element contains the text from the Preview Commands Editor, and is defined as follows:
<previewCommands>
attributes
None
children
text :: TEXT
The experiments element contains the BehaviorSpace experiments created in the model, and is defined as follows:
<experiments>
attributes
None
children
<experiment>
<experiment>
attributes
name :: String
repetitions :: Integer
sequentialRunOrder :: Boolean
runMetricsEveryStep :: Boolean
(optional) timeLimit :: Integer
children
<preExperiment>
<setup>
<go>
<postRun>
<postExperiment>
<exitCondition>
<runMetricsCondition>
<metrics>
<constants>
<subExperiments>
The experiment element can contain any number of children, but if an element is specified more than once, only the last occurrence in the file will be used to load the experiment.
<preExperiment>
attributes
None
children
source :: TEXT
<setup>
attributes
None
children
source :: TEXT
<go>
attributes
None
children
source :: TEXT
<postRun>
attributes
None
children
source :: TEXT
<postExperiment>
attributes
None
children
source :: TEXT
<exitCondition>
attributes
None
children
source :: TEXT
<runMetricsCondition>
attributes
None
children
source :: TEXT
<metrics>
attributes
None
children
<metric>
<metric>
attributes
None
children
source :: TEXT
<constants>
attributes
None
children
<steppedValueSet>
<enumeratedValueSet>
<steppedValueSet>
attributes
variable :: String
first :: Decimal
step :: Decimal
last :: Decimal
children
None
<enumeratedValueSet
attributes
variable :: String
children
<value>
<value>
attributes
value :: Any
children
None
<subExperiments>
attributes
None
children
<subExperiment>
<subExperiment>
attributes
None
children
<steppedValueSet>
<enumeratedValueSet>
The hubNetClient element contains the widgets created in the HubNet Client Editor, and is defined as follows:
<hubNetClient>
attributes
None
children
<button>
<slider>
<view>
<view3d>
<monitor>
<switch>
<plot>
<chooser>
<output>
<input>
<note>
The systemDynamics element contains the figures created in the System Dynamics Modeler, and is defined as follows:
<systemDynamics>
attributes
dt :: Double
children
<stock>
<converter>
<reservoir>
<binding>
<rate>
The systemDynamics element can contain any number of figures, which are defined as follows:
<stock>
attributes
name :: String
allowNegative :: Boolean
x :: Integer
y :: Integer
children
initialValue :: TEXT
<converter>
attributes
name :: String
x :: Integer
y :: Integer
children
expression :: TEXT
<reservoir>
attributes
x :: Integer
y :: Integer
children
None
<binding>
attributes
startFigure :: Integer
endFigure :: Integer
children
None
<rate>
attributes
name :: String
bivalent :: Boolean
startFigure :: Integer
endFigure :: Integer
children
expression :: TEXT
The resources element contains the external files bundled with a model, and is defined as follows:
<resources>
attributes
None
children
<resource>
<resource>
attributes
name :: String
extension :: String
children
data :: TEXT
Resource data that can be interpreted as plain text will be stored as such. All other resource data will be stored as Base64-encoded strings.
- Extensions
- NetLogo Libraries
- Controlling API
- Extensions API
- 6.0 Extension and Controlling API Transition-Guide
- Optimizing NetLogo Runs
- Setting English as the Default Language when Running NetLogo
- Unofficial Features
- Advanced Installation
- Optimization List
- Java System Properties and how to use them
- NetLogo on ARM Devices
- Multiple Views via HubNet
- Branches
- Building
- Tests
- Windows Setup
- Continuous Integration
- Draft: How to Help
- NetLogo Project Ideas
- Syntax Highlighting
- Building with IntelliJ
- Code Formatting
- Localization
- XML File Format
- Pre‐7.0.0 File Format (.nlogo) and Widget Format
- Benchmarking
- Releasing/Publishing
- Preparing the Models Library for Release
- Documentation
- NetLogo Bundled Java Versions
- JOGL
- Plugins API
- Architecture
- LazyAgentset
- Model Runs and Review Tab
- Model Runs: To Do and Code Overview
- Notes on in Radius
- Archived Branches
- Touch API Proposal
- Why isn't NetLogo "Parallel"?
- Potential Speedups
- Tortoise
- SimServer, WebStart, and NetLogo in Classrooms