XML Script

Overview

Model can be saved as a XML document. The resulting file uses the extension “.xml”.

Using the XML format is possible to write incomplete script having functors whose input and output ports are not completely bound. This allows saving models in the first development stages.

The XML document is written according to the following DTD 1) A good introduction to the DTD description syntax can be found at http://skew.org/xml/tutorial. :

<?xml version="1.0"?> <!DOCTYPE script [ <!ELEMENT script (property*, functor*, containerfunctor*)> <!ELEMENT functor (property*, inputport*, outputport*)> <!ATTLIST functor name CDATA #REQUIRED> <!ELEMENT containerfunctor (property*, inputport*, outputport*, internalinputport*, internaloutputport*, functor*)> <!ATTLIST containerfunctor name CDATA #REQUIRED> <!ELEMENT property EMPTY> <!ATTLIST property key CDATA #REQUIRED value CDATA #REQUIRED> <!ELEMENT inputport (#PCDATA)> <!ATTLIST inputport name CDATA #REQUIRED peerid IDREFS #IMPLIED> <!ELEMENT outputport EMPTY> <!ATTLIST outputport name CDATA #REQUIRED id ID #REQUIRED> <!ELEMENT internalinputport EMPTY> <!ATTLIST internalinputport name CDATA #REQUIRED peerid IDREFS #IMPLIED> <!ELEMENT internaloutputport EMPTY> <!ATTLIST internaloutputport name CDATA #REQUIRED id ID #REQUIRED> ]>

The resulting document is not formated using tabs, spaces or newlines. Those characters are written only when they are inside the definition content, not in the content boundaries.

Below it is an example of a XML script:

<?xml version="1.0" standalone="yes" ?> <script> <property key="dff.date" value="Fri Apr 22 16:07:49 2011" /> <property key="dff.version" value="1.6.2.20101213" /> <property key="metadata.author" value="Dinamica Team" /> <property key="metadata.description" value="This is an example of map algebra expression written in Dinamica’s Calculate Map functor. This functor also performs contextual image operation, such as edge detection filters using nbConvol expression." /> <property key="metadata.organization" value="CSR / UFMG" /> <property key="metadata.showproperties" value="yes" /> <property key="metadata.title" value="Apply Edge Detection Convolution Easier" /> <functor name="LoadMap"> <property key="dff.functor.alias" value="input map" /> <inputport name="filename">"../../lesson1/amazon_states.tif"</inputport> <inputport name="loadAsSparse">.no</inputport> <inputport name="defineNullValue">.no</inputport> <inputport name="nullValue">0</inputport> <inputport name="suffixDigits">0</inputport> <inputport name="step">.none</inputport> <inputport name="workdir">.none</inputport> <outputport name="map" id="v1" /> </functor> <functor name="SaveMap"> <property key="dff.functor.alias" value="saved map" /> <inputport name="map" peerid="v2" /> <inputport name="filename">"output.ers"</inputport> <inputport name="suffixDigits">0</inputport> <inputport name="step">.none</inputport> <inputport name="useCompression">.yes</inputport> <inputport name="workdir">.none</inputport> </functor> <containerfunctor name="CalculateMap"> <property key="dff.container.collapsed" value="yes" /> <property key="dff.functor.alias" value="edge map" /> <property key="dff.functor.comment" value="Image convolution in Dinamica EGO" /> <inputport name="expression">[ nbConvol(i1, t1, 3, 3) ]</inputport> <inputport name="cellType">.int32</inputport> <inputport name="nullValue">0</inputport> <inputport name="resultIsSparse">.no</inputport> <outputport name="result" id="v2" /> <functor name="NumberMap"> <property key="dff.functor.alias" value="numberMap1215" /> <inputport name="map" peerid="v1" /> <inputport name="mapNumber">1</inputport> </functor> <functor name="NumberTable"> <property key="dff.functor.alias" value="numberTable1216" /> <inputport name="table">[ "Key" "Value", 1 1 .. 4 1, 5 -8, 6 1 .. 9 1 ]</inputport> <inputport name="tableNumber">1</inputport> </functor> </containerfunctor> </script>